private async Task <bool> UpdateVerifiedPackagesAsync() { // The "old" data in this case is the latest file that was copied to the region's storage container by this // job (or initialized by Db2AzureSearch). var oldResult = await _verifiedPackagesDataClient.ReadLatestAsync( AccessConditionWrapper.GenerateEmptyCondition(), _stringCache); // The "new" data in this case is from the database. var newData = await _databaseFetcher.GetVerifiedPackagesAsync(); var changes = new HashSet <string>(oldResult.Data, oldResult.Data.Comparer); changes.SymmetricExceptWith(newData); _logger.LogInformation("{Count} package IDs have verified status changes.", changes.Count); if (changes.Count == 0) { return(false); } else { await _verifiedPackagesDataClient.ReplaceLatestAsync(newData, oldResult.Metadata.GetIfMatchCondition()); return(true); } }