public async Task <OrderModel> CreateOrderAsync(OrderModelItem orderModelItem, string userId)
        {
            var responseModel = new OrderModel();

            if (!orderModelItem.OrderItems.Any())
            {
                responseModel.Errors.Add(Constants.Errors.InvalidData);
                return(responseModel);
            }

            if (!long.TryParse(userId, out long _userId) || _userId == 0)
            {
                responseModel.Errors.Add(Constants.Errors.UserNotFound);
                return(responseModel);
            }

            var orderItems = new List <OrderItem>();

            var user = await _userRepository.GetUserByIdAsync(_userId);

            if (user == null)
            {
                responseModel.Errors.Add(Constants.Errors.UserNotFound);
                return(responseModel);
            }
            var payment = new Payment()
            {
                TransactionId = null
            };

            var paymentId = await _paymentRepository.CreateAsync(payment);

            var order = new Order()
            {
                Amount    = orderModelItem.OrderItems.Sum(x => x.Price * x.Count),
                PaymentId = paymentId,
                UserId    = user.Id
            };

            var orderId = await _orderRepository.CreateAsync(order);

            foreach (var orderPrintingEdition in orderModelItem.OrderItems)
            {
                var orderItem = orderPrintingEdition.MapToEntity();
                orderItem.OrderId = orderId;
                orderItems.Add(orderItem);
            }

            var orderItemsResult = await _orderItemRepository.CreateOrderItems(orderItems.ToArray());

            responseModel.Items.Add(new OrderModelItem
            {
                Id = orderId
            });

            return(responseModel);
        }