Methods to deal with database, offline and cache