protected async Task <Report> GetReportAsync(long ukprn, Guid reportId) { var report = await _client.GetReportAsync(reportId); if (report == null) { _logger.LogInformation("Cannot find report: {reportId}", reportId); throw new ReportNotFoundException($"Cannot find report: {reportId}"); } if (report.Owner.OwnerType == ReportOwnerType.Provider && report.Owner.Ukprn == ukprn) { return(report); } _logger.LogWarning("Ukprn: {ukprn} does not have access to report: {reportId}", ukprn, reportId); throw new AuthorisationException($"Ukprn: {ukprn} does not have access to report: {reportId}"); }