public async Task <ActionResult> ResetPassword(ResetPasswordViewModel model)
        {
            ViewBag.MenuItem  = CurrentMenuItem;
            ViewBag.ReturnUrl = "/UserAdministration";

            var user = await userManager.FindByIdAsync(model.Id);

            if (user == null)
            {
                model.UserName = "******";
                ModelState.AddModelError("", "No user found.");
                return(View());
            }

            model.UserName = user.UserName;

            if (ModelState.IsValid)
            {
                user.SecurityStamp = Guid.NewGuid().ToString("D");

                try
                {
                    var code = await userManager.GeneratePasswordResetTokenAsync(user.Id);

                    IdentityResult result = await userManager.ResetPasswordAsync(user.Id, code, model.Password);

                    if (result.Succeeded)
                    {
                        model.ResetComplete = true;
                        return(View(model));
                    }
                    else
                    {
                        model.ResetComplete = false;
                        AddErrors(result);
                        return(View(model));
                    }
                }
                catch (Exception ex)
                {
                    model.ResetComplete = true;
                    return(View(model));
                }
            }

            return(View(model));
        }