private async Task ProcessMessage(string message, CancellationToken token)
        {
            _logger.LogInformation("TransactionService. ProcessMessage. File received {0}", message);

            FileUploadInfo uploadInfo = null;

            try
            {
                uploadInfo = JsonConvert.DeserializeObject <FileUploadInfo>(message);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "TransactionService. ProcessMessage. Deserialization failed for file {0}", message);
            }


            _logger.LogInformation("TransactionService. ProcessMessage. File parsed. Message {0}", message);

            try
            {
                await AddFileToTransaction(uploadInfo);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "TransactionService. ProcessMessage. Add file information failed", new { UploadInfo = uploadInfo });
            }

            _logger.LogInformation("TransactionService. ProcessMessage. Completed. Message: {0}", message);
        }
        private async Task AddFileToTransaction(FileUploadInfo fileUploadInfo)
        {
            using (var scope = _scopeFactory.CreateScope())
            {
                var context = scope.ServiceProvider.GetRequiredService <DataContext>();

                var transactionExists = context.Transactions.Any(s => s.Id.ToString() == fileUploadInfo.TransactionId);
                if (transactionExists)
                {
                    context.Files.Add(new File {
                        Path = fileUploadInfo.FilePath, TransactionId = Guid.Parse(fileUploadInfo.TransactionId)
                    });
                }
                else
                {
                    throw new InvalidOperationException("Transaction does not exist");
                }

                await context.SaveChangesAsync();
            }
        }