public virtual IActionResult AddressAdd(UserAddressEditModel model)
        {
            if (!_workContext.CurrentUser.IsRegistered())
            {
                return(Challenge());
            }

            var user = _workContext.CurrentUser;

            //custom address attributes
            var customAttributes        = _addressAttributeParser.ParseCustomAddressAttributes(model.Form);
            var customAttributeWarnings = _addressAttributeParser.GetAttributeWarnings(customAttributes);

            foreach (var error in customAttributeWarnings)
            {
                ModelState.AddModelError("", error);
            }

            if (ModelState.IsValid)
            {
                var address = model.Address.ToEntity();
                address.CustomAttributes = customAttributes;
                address.CreatedOnUtc     = DateTime.UtcNow;
                //some validation
                if (address.CountryId == 0)
                {
                    address.CountryId = null;
                }
                if (address.StateProvinceId == 0)
                {
                    address.StateProvinceId = null;
                }
                //user.Addresses.Add(address);
                user.UserAddressMappings.Add(new UserAddressMapping {
                    Address = address
                });
                _userService.UpdateUser(user);

                return(RedirectToRoute("UserAddresses"));
            }

            //If we got this far, something failed, redisplay form
            _addressModelFactory.PrepareAddressModel(model.Address,
                                                     address: null,
                                                     excludeProperties: true,
                                                     addressSettings: _addressSettings,
                                                     loadCountries: () => _countryService.GetAllCountries(_workContext.WorkingLanguage.Id),
                                                     overrideAttributesXml: customAttributes);

            return(View(model));
        }