public ActionResult Profile(ProfileModel model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         MembershipUser user = Membership.GetUser(model.UserName);
         user.Email = model.Email;
         Membership.UpdateUser(user);
         UserProfile profile = UserProfile.GetUserProfile(User.Identity.Name);
         profile.FirstName = model.FirstName;
         profile.LastName = model.LastName;
         profile.Phone = model.Phone;
         profile.Save();
         return RedirectToAction("Index", "Home");
     }
     return View(model);
 }
 public ViewResult Profile(string returnUrl)
 {
     ViewBag.returnUrl = returnUrl;
     MembershipUser user = Membership.GetUser(User.Identity.Name);
     UserProfile profile = UserProfile.GetUserProfile(User.Identity.Name);
     var model = new ProfileModel
     {
         UserName = user.UserName,
         FirstName = profile.FirstName,
         LastName = profile.LastName,
         Email = user.Email,
         Phone = profile.Phone,
     };
     Company company = CompaniesRepository.Get(profile.CompanyId);
     if (company != null)
         model.Company = company.Name;
     return View(model);
 }