/// <returns>A task that represents the asynchronous operation</returns>
        public virtual async Task <IActionResult> Edit(VendorAttributeModel model, bool continueEditing)
        {
            if (!await _permissionService.AuthorizeAsync(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }

            //try to get a vendor attribute with the specified id
            var vendorAttribute = await _vendorAttributeService.GetVendorAttributeByIdAsync(model.Id);

            if (vendorAttribute == null)
            {
                return(RedirectToAction("List"));
            }

            if (ModelState.IsValid)
            {
                vendorAttribute = model.ToEntity(vendorAttribute);
                await _vendorAttributeService.UpdateVendorAttributeAsync(vendorAttribute);

                //activity log
                await _customerActivityService.InsertActivityAsync("EditVendorAttribute",
                                                                   string.Format(await _localizationService.GetResourceAsync("ActivityLog.EditVendorAttribute"), vendorAttribute.Id), vendorAttribute);

                //locales
                await UpdateAttributeLocalesAsync(vendorAttribute, model);

                _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Vendors.VendorAttributes.Updated"));
                if (!continueEditing)
                {
                    return(RedirectToAction("List"));
                }

                return(RedirectToAction("Edit", new { id = vendorAttribute.Id }));
            }

            //prepare model
            model = await _vendorAttributeModelFactory.PrepareVendorAttributeModelAsync(model, vendorAttribute, true);

            //if we got this far, something failed, redisplay form
            return(View(model));
        }