private OrderItem PrepareDefaultOrderItemFromProduct(Order order, Product product)
        {
            var presetQty   = 1;
            var presetPrice =
                _priceCalculationService.GetFinalPrice(product, order.Customer, decimal.Zero, true, presetQty);

            var presetPriceInclTax =
                _taxService.GetProductPrice(product, presetPrice, true, order.Customer, out _);
            var presetPriceExclTax =
                _taxService.GetProductPrice(product, presetPrice, false, order.Customer, out _);

            var orderItem = new OrderItem
            {
                OrderItemGuid       = new Guid(),
                UnitPriceExclTax    = presetPriceExclTax,
                UnitPriceInclTax    = presetPriceInclTax,
                PriceInclTax        = presetPriceInclTax,
                PriceExclTax        = presetPriceExclTax,
                OriginalProductCost = _priceCalculationService.GetProductCost(product, null),
                Quantity            = presetQty,
                Product             = product,
                Order = order
            };

            return(orderItem);
        }
        /// <summary>
        /// Move shopping cart items to order items
        /// </summary>
        /// <param name="details">Place order container</param>
        /// <param name="order">Order</param>
        protected override void MoveShoppingCartItemsToOrderItems(PlaceOrderContainer details, Order order)
        {
            //wgr
            var cart_size = details.Cart.Count();

            int[] mms_item_ids    = new int[cart_size];
            int[] mms_item_qtys   = new int[cart_size];
            int   mms_i           = 0;
            var   mmsDownloadList = new List <int>();
            var   firstName       = details.BillingAddress.FirstName;
            var   lastName        = details.BillingAddress.LastName;
            var   eMail           = details.Customer.Email;

            //wgr
            Debug.WriteLine(" ******  In Override for MoveShoppingCartItemsToOrderItems");

            foreach (var sc in details.Cart)
            {
                var product = _productService.GetProductById(sc.ProductId);

                //WGR build mms items for sales_order
                if (product.IsDownload == false)
                {
                    var mms_id = _mmsadminService.MmsGetMmsItemId(sc.ProductId);
                    if (mms_id > 0)
                    {
                        mms_item_ids[mms_i]  = mms_id;
                        mms_item_qtys[mms_i] = sc.Quantity;
                        mms_i++;
                    }
                }
                else
                {
                    var mms_id = _mmsadminService.MmsGetMmsItemId(sc.ProductId);
                    if (mms_id > 0)
                    {
                        mmsDownloadList.Add(mms_id);
                    }
                }
                //WGR

                //prices
                var scUnitPrice = _shoppingCartService.GetUnitPrice(sc);
                var scSubTotal  = _shoppingCartService.GetSubTotal(sc, true, out var discountAmount,
                                                                   out var scDiscounts, out _);
                var scUnitPriceInclTax =
                    _taxService.GetProductPrice(product, scUnitPrice, true, details.Customer, out var _);
                var scUnitPriceExclTax =
                    _taxService.GetProductPrice(product, scUnitPrice, false, details.Customer, out _);
                var scSubTotalInclTax =
                    _taxService.GetProductPrice(product, scSubTotal, true, details.Customer, out _);
                var scSubTotalExclTax =
                    _taxService.GetProductPrice(product, scSubTotal, false, details.Customer, out _);
                var discountAmountInclTax =
                    _taxService.GetProductPrice(product, discountAmount, true, details.Customer, out _);
                var discountAmountExclTax =
                    _taxService.GetProductPrice(product, discountAmount, false, details.Customer, out _);
                foreach (var disc in scDiscounts)
                {
                    if (!_discountService.ContainsDiscount(details.AppliedDiscounts, disc))
                    {
                        details.AppliedDiscounts.Add(disc);
                    }
                }

                //attributes
                var attributeDescription =
                    _productAttributeFormatter.FormatAttributes(product, sc.AttributesXml, details.Customer);

                var itemWeight = _shippingService.GetShoppingCartItemWeight(sc);

                //save order item
                var orderItem = new OrderItem
                {
                    OrderItemGuid         = Guid.NewGuid(),
                    OrderId               = order.Id,
                    ProductId             = product.Id,
                    UnitPriceInclTax      = scUnitPriceInclTax,
                    UnitPriceExclTax      = scUnitPriceExclTax,
                    PriceInclTax          = scSubTotalInclTax,
                    PriceExclTax          = scSubTotalExclTax,
                    OriginalProductCost   = _priceCalculationService.GetProductCost(product, sc.AttributesXml),
                    AttributeDescription  = attributeDescription,
                    AttributesXml         = sc.AttributesXml,
                    Quantity              = sc.Quantity,
                    DiscountAmountInclTax = discountAmountInclTax,
                    DiscountAmountExclTax = discountAmountExclTax,
                    DownloadCount         = 0,
                    IsDownloadActivated   = false,
                    LicenseDownloadId     = 0,
                    ItemWeight            = itemWeight,
                    RentalStartDateUtc    = sc.RentalStartDateUtc,
                    RentalEndDateUtc      = sc.RentalEndDateUtc
                };

                _orderService.InsertOrderItem(orderItem);

                //gift cards
                AddGiftCards(product, sc.AttributesXml, sc.Quantity, orderItem, scUnitPriceExclTax);

                //inventory
                _productService.AdjustInventory(product, -sc.Quantity, sc.AttributesXml,
                                                string.Format(_localizationService.GetResource("Admin.StockQuantityHistory.Messages.PlaceOrder"), order.Id));
            }
            //WGR Add to MMS SO
            _mmsadminService.MmsAddSOItems(mms_item_ids, mms_item_qtys);
            //WGR Add downloads
            var mmsSuccess = _mmsadminService.MmsJsonAddOrder(firstName, lastName, eMail, mmsDownloadList);

            if (mmsSuccess != "success")
            {
                Debug.WriteLine("Error Adding Downloads: " + mmsSuccess);
            }
            //clear shopping cart
            details.Cart.ToList().ForEach(sci => _shoppingCartService.DeleteShoppingCartItem(sci, false));
        }