/// <returns>A task that represents the asynchronous operation</returns>
        public async Task <IActionResult> EditRateByWeightByTotalPopup(ShippingByWeightByTotalModel model)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageShippingSettings))
            {
                return(AccessDeniedView());
            }

            var sbw = await _shippingByWeightService.GetByIdAsync(model.Id);

            if (sbw == null)
            {
                //no record found with the specified id
                return(RedirectToAction("Configure"));
            }

            sbw.StoreId                  = model.StoreId;
            sbw.WarehouseId              = model.WarehouseId;
            sbw.CountryId                = model.CountryId;
            sbw.StateProvinceId          = model.StateProvinceId;
            sbw.Zip                      = model.Zip == "*" ? null : model.Zip;
            sbw.ShippingMethodId         = model.ShippingMethodId;
            sbw.WeightFrom               = model.WeightFrom;
            sbw.WeightTo                 = model.WeightTo;
            sbw.OrderSubtotalFrom        = model.OrderSubtotalFrom;
            sbw.OrderSubtotalTo          = model.OrderSubtotalTo;
            sbw.AdditionalFixedCost      = model.AdditionalFixedCost;
            sbw.RatePerWeightUnit        = model.RatePerWeightUnit;
            sbw.PercentageRateOfSubtotal = model.PercentageRateOfSubtotal;
            sbw.LowerWeightLimit         = model.LowerWeightLimit;
            sbw.TransitDays              = model.TransitDays;

            await _shippingByWeightService.UpdateShippingByWeightRecordAsync(sbw);

            ViewBag.RefreshPage = true;

            return(View("~/Plugins/Shipping.FixedByWeightByTotal/Views/EditRateByWeightByTotalPopup.cshtml", model));
        }