public virtual async Task <CustomerOrderAggregate> Handle(CreateOrderFromCartCommand request, CancellationToken cancellationToken)
        {
            var cart = await _cartService.GetByIdAsync(request.CartId);

            var result = await _customerOrderAggregateRepository.CreateOrderFromCart(cart);

            return(result);
        }
        public virtual async Task <CustomerOrderAggregate> Handle(CreateOrderFromCartCommand request, CancellationToken cancellationToken)
        {
            var cart = await _cartService.GetByIdAsync(request.CartId);

            await ValidateCart(cart);

            var result = await _customerOrderAggregateRepository.CreateOrderFromCart(cart);

            await _cartService.DeleteAsync(new List <string> {
                request.CartId
            }, softDelete : true);

            // Remark: There is potential bug, because there is no transaction thru two actions above. If a cart deletion fails, the order remains. That causes data inconsistency.
            // Unfortunately, current architecture does not allow us to support such scenarios in a transactional manner.
            return(result);
        }