public async Task <OrderPlaced> Handle(PlaceOrder command)
        {
            var(clientId, offer) = CreateDomainModelFrom(command);
            var currentOffer = await _calculatePrices.For(clientId,
                                                          SalesChannel.OnlineSales,
                                                          offer.ProductAmounts,
                                                          offer.Currency);

            if (!offer.Equals(currentOffer))
            {
                throw new DomainException();
            }
            var order       = Order.FromOffer(offer);
            var orderHeader = new OrderHeader
            {
                Id               = order.Id.Value,
                ClientId         = clientId.Value,
                InvoicingDetails = command.InvoicingDetails
            };
            await _orders.Save(order);

            await _crudOperations.Create(orderHeader);

            var orderPlaced = CreateEventFrom(clientId, order);

            _eventsOutbox.Add(orderPlaced);
            return(orderPlaced);
        }
        public async Task <OrderCreated> Handle(CreateOrder command)
        {
            var clientId    = CreateDomainModelFrom(command);
            var order       = Order.New();
            var orderHeader = new OrderHeader {
                Id = order.Id.Value, ClientId = clientId.Value
            };
            await _orders.Save(order);

            await _crudOperations.Create(orderHeader);

            var orderCreated = CreateEventFrom(order, clientId);

            _eventsOutbox.Add(orderCreated);
            return(orderCreated);
        }