public Task SyncDailyMissions() => Task.Run(async() => { var version = _remoteConfig.GetInt(Parameter.DailyMissionsVersion); // If there's no current daily mission, load it from Firebase var localItemsNumber = await _localDatabase.GetDailyMissionsNumber(); if (localItemsNumber == 0) { await CreateOrUpdateDailyMissions(version, 0); return; } // If the daily mission version is less than the remote version, update it var maxLocalItemsVersion = await _localDatabase.GetMaxDailyMissionVersion(); if (maxLocalItemsVersion < version) { var lastCompletedNumber = (await _localDatabase.GetLastCompletedDailyMission())?.DayNumber ?? 0; await CreateOrUpdateDailyMissions(version, lastCompletedNumber); return; } });