Feature/intermittent background sync

ALMOST complete background sync, needs to add more test, complete few TODOs: but background sync works now on app start up and on device online status change. NB: clear local storage