private void SuccessfulRead(
            string path,
            UploadFileProcessorResult <OrderFileContract, Order> csvReadResults,
            ISystemProcessOperationUploadFileContext fileUpload)
        {
            var uploadGuid = Guid.NewGuid().ToString();
            var orders     = this._omsVersioner.ProjectOmsVersion(csvReadResults.SuccessfulReads) ?? new Order[0];

            this._logger.LogInformation($"{path} is about to submit {orders?.Count} records to the orders repository.");

            foreach (var item in orders)
            {
                item.IsInputBatch = true;
                item.InputBatchId = uploadGuid;
                item.BatchSize    = orders.Count;
                this._ordersRepository.Create(item).Wait();
            }

            this._logger.LogInformation(
                $"{path} has uploaded the csv records. Now about to link uploaded orders to file upload id.");
            this.InsertFileUploadOrderIds(orders, fileUpload);
            this._logger.LogInformation($"{path} has uploaded the csv records. Now about to enrich the security data.");
            this._enrichmentService.Scan();
            this._logger.LogInformation($"{path} has enriched the csv records. Now about to delete {path}.");
            this.ReddeerDirectory.Delete(path);
            this._logger.LogInformation($"{path} has deleted the file. Now about to check for unsuccessful reads.");

            this._logger.LogInformation(
                $"Successfully processed file for {path}. Did not find any unsuccessful reads.");
            fileUpload.EndEvent().EndEvent();
        }
        private void SuccessfulRead(
            string path,
            UploadFileProcessorResult <AllocationFileContract, OrderAllocation> csvReadResults,
            ISystemProcessOperationUploadFileContext fileUpload)
        {
            this.Logger.LogInformation(
                $"AllocationFileMonitor for {path} is about to submit {csvReadResults.SuccessfulReads?.Count} records to the trade upload stream");
            var allocationIds = this._allocationRepository.Create(csvReadResults.SuccessfulReads).Result;

            this.LinkFileUploadDataToUpload(fileUpload?.FileUpload, allocationIds);
            this.Logger.LogInformation(
                $"AllocationFileMonitor for {path} has uploaded the csv records. Now about to delete {path}.");
            this.ReddeerDirectory.Delete(path);
            this.Logger.LogInformation(
                $"AllocationFileMonitor for {path} has deleted the file. Now about to check for unsuccessful reads.");

            this.Logger.LogInformation(
                $"AllocationFileMonitor successfully processed file for {path}. Did not find any unsuccessful reads.");
            fileUpload?.EndEvent()?.EndEvent();
        }
        private void FailedRead(
            string path,
            UploadFileProcessorResult <OrderFileContract, Order> csvReadResults,
            ISystemProcessOperationUploadFileContext fileUpload)
        {
            var originatingFileName = Path.GetFileNameWithoutExtension(path);

            this._logger.LogError(
                $"Errors when processing file {path} and has {csvReadResults.UnsuccessfulReads.Count} failed uploads. About to write records to logs.");

            foreach (var row in csvReadResults.UnsuccessfulReads)
            {
                this._logger.LogInformation($"Could not parse row {row.RowId} of {originatingFileName}.");
            }

            this._logger.LogInformation(
                $"{path} has errors and will not commit to further processing. Now about to delete {path}.");
            this.ReddeerDirectory.Delete(path);
            this._logger.LogInformation($"{path} has deleted the file.");

            fileUpload.EndEvent().EndEventWithError(
                $"Had failed reads ({csvReadResults.UnsuccessfulReads.Count}) written to disk {this.GetFailedReadsPath()}");
        }