How to synchronize mysql data from server to ionic

I am writing a factory for synchronizing of data from mysql server with the $http service and storing to sqlite. But when it starts to synchronize i get random values just like some time it store two values to sqlite and sometime 4 or 5 values but couldnot save all the values. I am hitting many api to fetch data cuz so many api is there .What should i do to prevent this kind of problem. I have googled but i found nothing just only pouchdb couchdb like solution. But i am currently using mysql as server database.