public virtual async Task <ActionResult> Manage(ManageUserViewModel model)
        {
            bool hasPassword = _securityManager.HasPassword(User.Identity.GetUserId());

            ViewBag.HasLocalPassword = hasPassword;
            ViewBag.ReturnUrl        = Url.Action(MVC.Account.Manage());

            if (hasPassword)
            {
                if (ModelState.IsValid)
                {
                    IdentityResult result = await _securityManager.ChangePasswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);

                    if (result.Succeeded)
                    {
                        return(RedirectToAction(MVC.Account.Manage(ManageMessageIdEnum.ChangePasswordSuccess)));
                    }
                    else
                    {
                        AddErrors(result);
                    }
                }
            }
            else
            {
                // User does not have a password so remove any validation errors caused by a missing OldPassword field
                ModelState state = ModelState["OldPassword"];
                if (state != null)
                {
                    state.Errors.Clear();
                }

                if (ModelState.IsValid)
                {
                    IdentityResult result = await _securityManager.AddPasswordAsync(User.Identity.GetUserId(), model.NewPassword);

                    if (result.Succeeded)
                    {
                        return(RedirectToAction(MVC.Account.Manage(ManageMessageIdEnum.SetPasswordSuccess)));
                    }
                    else
                    {
                        AddErrors(result);
                    }
                }
            }

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