protected void btnSave_Click(object sender, EventArgs e)
        {
            ProductField toSave = new ProductField();

            if (!toSave.LoadByPrimaryKey(ParamId.GetValueOrDefault(-1)))
            {
                // NEW field
                toSave           = new ProductField();
                toSave.ProductId = ParamProductId.Value;
                ProductFieldWidgetType widgetType;
                if (!WA.Enum <ProductFieldWidgetType> .TryParse(ddlWidgetType.SelectedValue, out widgetType))
                {
                    throw new ArgumentException("Unable to determine WidgetType");
                }
                toSave.WidgetType = ddlWidgetType.SelectedValue;
                toSave.SortOrder  = 99;
                toSave.Slug       = txtName.Text.CreateSpecialSlug(true, 100);
                if (ProductField.SlugExistsForProductField(toSave.ProductId.Value, toSave.Slug))
                {
                    toSave.Slug = ProductField.GetNextAvailableSlug(toSave.ProductId.Value, toSave.Slug);
                }
            }

            toSave.Name       = txtName.Text;
            toSave.IsRequired = chkIsRequired.Checked;

            switch (toSave.WidgetTypeName)
            {
            case ProductFieldWidgetType.Textbox:
            case ProductFieldWidgetType.Textarea:
            case ProductFieldWidgetType.Checkbox:
                toSave.PriceAdjustment  = WA.Parser.ToDecimal(txtPriceAdjustment.Text);
                toSave.WeightAdjustment = WA.Parser.ToDecimal(txtWeightAdjustment.Text);

                // no 'choices' for these types
                toSave.ProductFieldChoiceCollectionByProductFieldId.MarkAllAsDeleted();
                break;

            default:
                // no field-level adjustments for these types (adjustments are done at the choice-level)
                toSave.PriceAdjustment  = null;
                toSave.WeightAdjustment = null;

                // save/update the 'choices'
                List <string> optionNames         = WA.Web.WebHelper.GetFormValuesByName("optionName", Request);
                List <string> optionValues        = WA.Web.WebHelper.GetFormValuesByName("optionValue", Request);
                List <string> optionPriceAdjusts  = WA.Web.WebHelper.GetFormValuesByName("optionPriceAdjust", Request);
                List <string> optionWeightAdjusts = WA.Web.WebHelper.GetFormValuesByName("optionWeightAdjust", Request);
                if (optionNames.Count == optionPriceAdjusts.Count && optionNames.Count == optionWeightAdjusts.Count)
                {
                    toSave.ProductFieldChoiceCollectionByProductFieldId.MarkAllAsDeleted();

                    for (int i = 0; i < optionNames.Count; i++)
                    {
                        if (!string.IsNullOrEmpty(optionNames[i]))
                        {
                            ProductFieldChoice newChoice = toSave.ProductFieldChoiceCollectionByProductFieldId.AddNew();
                            newChoice.Name             = optionNames[i];
                            newChoice.Value            = string.IsNullOrEmpty(optionValues[i]) ? optionNames[i] : optionValues[i];
                            newChoice.PriceAdjustment  = WA.Parser.ToDecimal(optionPriceAdjusts[i]);
                            newChoice.WeightAdjustment = WA.Parser.ToDecimal(optionWeightAdjusts[i]);
                            newChoice.SortOrder        = (short)i;
                        }
                    }
                }
                else
                {
                    throw new ArgumentException(
                              "Unable to parse/determine values for Product Choice Names and Adjustments");
                }
                break;
            }
            toSave.Save();


            // redirect back to Edit Product Url
            Response.Redirect(StoreUrls.AdminEditProduct(toSave.ProductId.Value, "Product variant/attribute saved"));
        }