You can use this code to cache your data from network