class ListRepository @Inject constructor(val api: ApiService, val db: Database?) { suspend fun getItemList(id: String, currentPage: String?) = try { val response = api.getReviewList(id, currentPage) if (response.isSuccessful) { Resource.success(response.body()) } else { Resource.error(response.message()) } } catch (e: Exception) { Resource.error(e.message) } suspend fun insertResultIntoDb(items: List) { db?.itemListDao()?.insertItemList(items) } }