public async Task <GenerateReport> InsertAndTriggerGenerateReport(ReportingEvent reportingEventDto)
        {
            var reportingEvent = DomainAdapter.MapReportingEvent(reportingEventDto);

            _logger.LogInformation("Inserting record to the FileInformation Table");
            await _fileInformationRepository.UpdateRecord(FileInformation.Get(reportingEvent, new Uri("https://raetgdprtbldev.blob.core.windows.net"), "HashProcessing", "Processing"));

            string message = JsonConvert.SerializeObject(reportingEvent);

            _logger.LogInformation("Adding message to report-file-queue");
            _azureQueueStorageRepository.AddAsync(message);
            return(new GenerateReport()
            {
                FileName = reportingEvent.FileName, Guid = reportingEvent.Guid
            });
        }
        public async Task <GenerateReport> GenerateReport(Domain.ReportingEvent reportingEvent)
        {
            try
            {
                var data = await _reportingStorage.FetchReportingData(reportingEvent);

                if (data.Count >= _maxCount)
                {
                    throw new ConstraintException(
                              $"Exceeds max record count, limit is {_maxCount} and actual count is {data.Count}");
                }

                var mapCSVData = Mapper.Map <IList <Domain.EffectiveAuthorizationInterval>, List <Domain.EffectiveIntervalCSVMapper> >(data);

                var csvData = CsvSerializer.SerializeToCsv(mapCSVData);

                var hash = _checksumGenerator.Generate(csvData);

                var url = await _azureBlobStorageRepository.UploadFileAsync(csvData, reportingEvent.FileNameTimeStamp);

                await _fileInformationRepository.UpdateRecord(FileInformation.Get(reportingEvent, url, hash, "Completed"));

                return(new GenerateReport()
                {
                    FileName = reportingEvent.FileName, Hash = hash
                });
            }

            catch (Exception ex)
            {
                _logger.LogError(ex.InnerException, ex.Message);
                await _fileInformationRepository.UpdateRecord(FileInformation.Get(reportingEvent, new Uri("https://raetgdprtbldev.blob.core.windows.net"), ex.Message, "Failed"));

                return(new GenerateReport()
                {
                    FileName = reportingEvent.FileName, Hash = ex.Message
                });
            }
        }