public async Task <IActionResult> ChangePassword(ChangePasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _userHelper.GetUserByEmailAsync(model.UserName);

                if (user == null)
                {
                    return(NotFound());
                }

                string oldPassword = model.OldPassword;
                string newPassword = model.NewPassword;


                var checkPassword = await _userHelper.CheckPasswordAsync(user, oldPassword);

                if (!checkPassword)
                {
                    ModelState.AddModelError(string.Empty, "Your Current password is invalid, please try again");
                    return(View(model));
                }

                var result = await _userHelper.ChangePasswordAsync(user, oldPassword, newPassword);

                if (!result.Succeeded)
                {
                    ModelState.AddModelError(string.Empty, "Unable to change password, try again later");
                    return(View(model));
                }

                @ViewBag.Message = "Password changed successfully";
                return(View(model));
            }

            return(View(model));
        }