public async Task<ActionResult> ChangePassword(String id, ManageModel model)
        {

            if (ModelState.IsValid)
            {
                IdentityResult result = await userRepository.ChangePaswordAsync(id, model.OldPassword, model.NewPassword);
                if (result.Succeeded)
                {
                    TempData["Info"] = "Wachtwoord werd gewijzigd";
                    return View("GetProfile", id);
                }
                else
                {
                    TempData["Message"] = "Wachtwoord niet correct";
                    return RedirectToAction("ChangePassword", model);
                }
            }


            return RedirectToAction("ChangePassword", model);

        }
        public async Task<ActionResult> Manage(ManageModel model)
        {
            bool hasPassword = HasPassword();
            ViewBag.HasLocalPassword = hasPassword;
            ViewBag.ReturnUrl = Url.Action("Manage");
            if (hasPassword)
            {
                if (ModelState.IsValid)
                {
                    IdentityResult result = await UserRepository.ChangePaswordAsync(User.Identity.GetUserId(), model.OldPassword, model.NewPassword);
                    if (result.Succeeded)
                    {
                        if (User.Identity.GetUserName().EndsWith("@student.hogent.be"))
                        {
                            StudentRepository.UpdateFirstTime(User.Identity.GetUserName(), true);
                           Student s = StudentRepository.FindById(User.Identity.GetUserId());
                            return RedirectToAction("Index","Student",s);

                        }
                        if (User.Identity.GetUserName().EndsWith("@hogent.be"))
                        {
                            StagebegeleiderRepository.UpdateFirstTime(User.Identity.GetUserName());
                            Stagebegeleider s = StagebegeleiderRepository.FindById(User.Identity.GetUserId());
                            return RedirectToAction("Index", "StageBegeleider", s);
                        }

                        return RedirectToAction("Manage", new { Message = ManageMessageId.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 UserRepository.AddAsyncPassword(User.Identity.GetUserId(), model.NewPassword);
                    if (result.Succeeded)
                    {
                        return RedirectToAction("Manage", new { Message = ManageMessageId.SetPasswordSuccess });
                    }
                    else
                    {
                        AddErrors(result);
                    }
                }
            }

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