public string UpdateCartQuantity(Distributor distributorData)
        {
            if (distributorData.ItemQuantity < 1)
            {
                throw new Exception(ResHelper.GetString("KDA.Cart.Update.MinimumQuantityError", LocalizationContext.CurrentCulture.CultureCode));
            }
            var shoppingCartItem = ShoppingCartItemInfoProvider.GetShoppingCartItemInfo(distributorData.CartItemId);

            if (distributorData.InventoryType == 1)
            {
                var shoppingCartIDs   = ShoppingCartInfoProvider.GetShoppingCarts().WhereEquals("ShoppingCartUserID", distributorData.UserID).WhereEquals("ShoppingCartInventoryType", 1).ToList().Select(x => x.ShoppingCartID).ToList();
                var shoppingcartItems = ShoppingCartItemInfoProvider.GetShoppingCartItems().WhereIn("ShoppingCartID", shoppingCartIDs).WhereEquals("SKUID", shoppingCartItem.SKUID).ToList();
                int totalItems        = 0;
                shoppingcartItems.ForEach(cartItem =>
                {
                    if (cartItem != null && cartItem.CartItemID != distributorData.CartItemId)
                    {
                        totalItems += cartItem.CartItemUnits;
                    }
                });
                var sku                  = SKUInfoProvider.GetSKUInfo(shoppingCartItem.SKUID);
                var currentProduct       = DocumentHelper.GetDocuments(campaignClassName).WhereEquals("NodeSKUID", sku.SKUID).Columns("CampaignsProductID").FirstOrDefault();
                var productHasAllocation = currentProduct != null?productProvider.IsProductHasAllocation(currentProduct.GetValue <int>("CampaignsProductID", default(int))) : false;

                var allocatedQuantityItem = GetAllocatedProductQuantityForUser(currentProduct.GetValue <int>("CampaignsProductID", default(int)), distributorData.UserID);
                var allocatedQuantity     = allocatedQuantityItem != null?allocatedQuantityItem.GetValue <int>("Quantity", default(int)) : default(int);

                if (sku.SKUAvailableItems < totalItems + distributorData.ItemQuantity)
                {
                    throw new Exception(ResHelper.GetString("KDA.Cart.Update.InsufficientStockMessage", LocalizationContext.CurrentCulture.CultureCode));
                }
                else if (allocatedQuantity < totalItems + distributorData.ItemQuantity && productHasAllocation)
                {
                    throw new Exception(ResHelper.GetString("Kadena.AddToCart.AllocatedProductQuantityError", LocalizationContext.CurrentCulture.CultureCode));
                }
            }
            if (shoppingCartItem != null)
            {
                shoppingCartItem.CartItemUnits = distributorData.ItemQuantity;
                shoppingCartItem.Update();
                return(ResHelper.GetString("KDA.Cart.Update.Success"));
            }
            else
            {
                throw new Exception(ResHelper.GetString("KDA.Cart.Update.Failure", LocalizationContext.CurrentCulture.CultureCode));
            }
        }