private async Task RemoveFromStockAsync(OrderSubmittedIntegrationEvent orderSubmittedIntegrationEvent, CancellationToken cancellationToken)
 {
     foreach (OrderItem orderItem in orderSubmittedIntegrationEvent.OrderItems)
     {
         string correlationId = CorrelationIdGenerator.DecreaseFromStock(orderSubmittedIntegrationEvent.OrderId, orderItem.ProductId);
         RemoveFromStockCommand removeFromStockCommand = new RemoveFromStockCommand(orderItem.ProductId,
                                                                                    orderItem.Quantity,
                                                                                    correlationId);
         try
         {
             using (IExecutionContext executionContext = GetExecutionContext())
                 await executionContext.ExecuteAsync(removeFromStockCommand, cancellationToken);
         }
         catch (StockActionAlreadyExistException)
         {
             continue;
         }
     }
 }
        public async Task Consume(ConsumeContext <OrderRollbackIntegrationCommand> context)
        {
            var orderRollbackIntegrationCommand = context.Message;
            var cancellationToken = context.CancellationToken;

            foreach (OrderItem orderItem in orderRollbackIntegrationCommand.OrderItems)
            {
                string correlationId = CorrelationIdGenerator.DecreaseFromStock(orderRollbackIntegrationCommand.OrderId, orderItem.ProductId);
                var    rollbackDecreaseFromStockCommand = new RollbackDecreaseFromStockCommand(correlationId);
                try
                {
                    using (var executionContext = GetExecutionContext())
                    {
                        await executionContext.ExecuteAsync(rollbackDecreaseFromStockCommand, cancellationToken);
                    }
                }
                catch (StockActionNotFoundException)
                {
                    continue;
                }
            }
        }