working receiving and saving to local database