protected void SaveLocalizableContent(ProductAttribute productAttribute) { if (productAttribute == null) { return; } if (!this.HasLocalizableContent) { return; } foreach (RepeaterItem item in rptrLanguageDivs.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { var txtLocalizedName = (TextBox)item.FindControl("txtLocalizedName"); var txtLocalizedDescription = (TextBox)item.FindControl("txtLocalizedDescription"); var lblLanguageId = (Label)item.FindControl("lblLanguageId"); int languageId = int.Parse(lblLanguageId.Text); string name = txtLocalizedName.Text; string description = txtLocalizedDescription.Text; bool allFieldsAreEmpty = (string.IsNullOrEmpty(name) && string.IsNullOrEmpty(description)); var content = ProductAttributeManager.GetProductAttributeLocalizedByProductAttributeIdAndLanguageId(productAttribute.ProductAttributeId, languageId); if (content == null) { if (!allFieldsAreEmpty && languageId > 0) { //only insert if one of the fields are filled out (avoid too many empty records in db...) content = ProductAttributeManager.InsertProductAttributeLocalized(productAttribute.ProductAttributeId, languageId, name, description); } } else { if (languageId > 0) { content = ProductAttributeManager.UpdateProductAttributeLocalized(content.ProductAttributeLocalizedId, content.ProductAttributeId, languageId, name, description); } } } } }