public async Task GenerateAllReports(ILogger log) { var reportsList = new List <CourseMigrationReport>(); using (var client = _cosmosDbHelper.GetClient()) { var reports = await _cosmosDbHelper.GetAllDocuments <CourseMigrationReport>(client, _settings.ApprenticeshipMigrationReportCollectionId); reportsList.AddRange(reports); } foreach (var report in reportsList) { try { await UpdateReport(int.Parse(report.ProviderUKPRN.ToString())); } catch (Exception ex) { if (!ex.Message.Contains("Unable to generate report for Provider")) { var t = ex; } log.LogWarning($"Unable to update Report for Provider{report.ProviderUKPRN.ToString()}"); } } }