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

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

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

            if (ModelState.IsValid)
            {
                var value = model.ToEntity <VendorAttributeValue>();

                await _vendorAttributeService.InsertVendorAttributeValueAsync(value);

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

                await UpdateValueLocalesAsync(value, model);

                ViewBag.RefreshPage = true;

                return(View(model));
            }

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

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