public async Task<ActionResult> Manage(ManageUserViewModel model)
        {           
            string userId = User.Identity.GetUserId();
            
            bool hasLocalLogin = await IdentityManager.Logins.HasLocalLoginAsync(userId);
            ViewBag.HasLocalPassword = hasLocalLogin;

            ExtendedUser user = Data.Users.All().Where(u => u.Id == userId).FirstOrDefault();
            ViewBag.UserId = userId;
            user.FirstName  = model.FirstName;         
            user.LastName  = model.LastName;
            user.Description = model.Description;   

            Data.SaveChanges();
            //if (hasLocalLogin)
            //{               
            //    if (ModelState.IsValid)
            //    {
            //        IdentityResult result = await IdentityManager.Passwords.ChangePasswordAsync(User.Identity.GetUserName(), model.OldPassword, model.NewPassword);
            //        if (result.Success)
            //        {
            //            return RedirectToAction("Manage", new { Message = "Your password has been changed." });
            //        }
            //        else
            //        {
            //            AddErrors(result);
            //        }
            //    }
            //}
            //else
            //{
            //    // User does not have a local 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)
            //    {
            //        // Create the local login info and link it to the user
            //        IdentityResult result = await IdentityManager.Logins.AddLocalLoginAsync(userId, User.Identity.GetUserName(), model.NewPassword);
            //        if (result.Success)
            //        {
            //            return RedirectToAction("Manage", new { Message = "Your password has been set." });
            //        }
            //        else
            //        {
            //            AddErrors(result);
            //        }
            //    }
            //}

            // If we got this far, something failed, redisplay form
           
            return View(model);
        }
        //
        // GET: /Account/Manage
        public async Task<ActionResult> Manage(string message)
        {
            ViewBag.StatusMessage = message ?? "";
            ViewBag.HasLocalPassword = await IdentityManager.Logins.HasLocalLoginAsync(User.Identity.GetUserId());
            ViewBag.ReturnUrl = Url.Action("Manage");
            string userId = User.Identity.GetUserId();
            PopulateFields(userId);

            bool isAuthor = Data.Users.All().FirstOrDefault(u=>u.Id == userId).Roles.Any(r=>r.Role.Name == "Author");
            ManageUserViewModel model = new ManageUserViewModel
            {
                IsAuthor = isAuthor,
                Username = User.Identity.GetUserName()
            };
            return View(model);
        }