public ActionResult Create(CompanyBranchUser companybranchuser)
        {
            if (ModelState.IsValid)
            {
                db.CompanyBranchUsers.Add(companybranchuser);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.BranchId = new SelectList(db.Branches, "Id", "Description", companybranchuser.BranchId);
            return View(companybranchuser);
        }
        //GET: All Accounts
        public ActionResult Index()
        {
            MembershipUserCollection collection = Membership.GetAllUsers();
            List<CompanyBranchUser> users = db.CompanyBranchUsers.Include(c => c.ParentBranch).ToList<CompanyBranchUser>();
            foreach (MembershipUser item in collection)
            {
                CompanyBranchUser currentUser = null;
                try
                {
                    currentUser = users.Single<CompanyBranchUser>(cbu => cbu.UserName == item.UserName);
                }
                catch(Exception ex)
                {
                    currentUser = new CompanyBranchUser
                    {
                        UserName = item.UserName,
                        Email = item.UserName
                    };
                }
                users.Add(new CompanyBranchUser
                {
                    Email = item.Email,
                    UserName = item.UserName
                });

            }
            ViewData["BranchId"] = db.Branches.AsEnumerable<Branch>();
            return View(users.AsQueryable<CompanyBranchUser>());
        }
 public ActionResult Edit(CompanyBranchUser companybranchuser)
 {
     if (ModelState.IsValid)
     {
         db.Entry(companybranchuser).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.BranchId = new SelectList(db.Branches, "Id", "Description", companybranchuser.BranchId);
     return View(companybranchuser);
 }