public UserProfile Save(UserProfile profile)
 {
     using (var ctx = this.GetContext())
     {
         ctx.Entry(profile).State = this.GetProfile(profile.UserName) != null ? EntityState.Modified : EntityState.Added;
         ctx.SaveChanges();
         return profile;
     }            
 }
 public new ActionResult Profile(UserProfile profile)
 {
     this.repository.Save(profile);
     ViewBag.Managers = new SelectList(this.GetManagers(), "UserName", "FullName", profile.ManagerId);
     return RedirectToAction("Dashboard", "Home");
 }