public virtual async Task<IActionResult> Edit(int id)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageSettings))
                return AccessDeniedView();

            //try to get a customer attribute with the specified id
            var customerAttribute = await _customerAttributeService.GetCustomerAttributeByIdAsync(id);
            if (customerAttribute == null)
                return RedirectToAction("List");

            //prepare model
            var model = await _customerAttributeModelFactory.PrepareCustomerAttributeModelAsync(null, customerAttribute);

            return View(model);
        }
        /// <summary>
        /// Gets selected customer attributes
        /// </summary>
        /// <param name="attributesXml">Attributes in XML format</param>
        /// <returns>
        /// A task that represents the asynchronous operation
        /// The task result contains the selected customer attributes
        /// </returns>
        public virtual async Task <IList <CustomerAttribute> > ParseCustomerAttributesAsync(string attributesXml)
        {
            var result = new List <CustomerAttribute>();

            if (string.IsNullOrEmpty(attributesXml))
            {
                return(result);
            }

            var ids = ParseCustomerAttributeIds(attributesXml);

            foreach (var id in ids)
            {
                var attribute = await _customerAttributeService.GetCustomerAttributeByIdAsync(id);

                if (attribute != null)
                {
                    result.Add(attribute);
                }
            }

            return(result);
        }