working offline and online data syn using with api