public static Courier <AppUser> PackageChangePassword(AccountChangePasswordVM package)
        {
            IdentityManager mgr = new IdentityManager();

            UpdatePasswordParcel parcel = new UpdatePasswordParcel()
            {
                User        = package.User,
                NewPassword = package.NewPassword
            };

            return(mgr.ChangePassword(parcel));
        }
        //[Authorize(Roles = "Sales, Admin")]
        public ActionResult ChangePassword(AccountChangePasswordVM model)
        {
            if (model.NewPassword != model.ConfirmPassword)
            {
                ModelState.AddModelError("ConfirmPassword", "Your password confirmation did not match the password you entered.");
            }

            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            else
            {
                var user = IdentityPostmaster.RetrieveUserByName(User.Identity.Name);

                if (user.Success)
                {
                    model.User = user.Package;
                }
                else
                {
                    throw new Exception(user.Message);
                }

                var result = IdentityPostmaster.PackageChangePassword(model);

                if (result.Success)
                {
                    var userManager = HttpContext.GetOwinContext().GetUserManager <UserManager <AppUser> >();
                    var authManager = HttpContext.GetOwinContext().Authentication;

                    authManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

                    var identity = userManager.CreateIdentity(result.Package, DefaultAuthenticationTypes.ApplicationCookie);
                    authManager.SignIn(identity);

                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError("NewPassword", result.Message);

                    return(View(model));
                }
            }
        }