public ActionResult Create(AccountCreateViewModel accountCreateViewModel) { try { Account account = new Account(); account.Id = accountCreateViewModel.Id; account.Name = accountCreateViewModel.Name; account.DateCreated = DateTime.Now; account.DateUpdated = DateTime.Now; foreach (var contactSelectedId in accountCreateViewModel.ContactSelectId) { var contact = _contactQueries.GetOneById(contactSelectedId); account.Contacts.Add(contact); } _accountQueries.Save(account); return(RedirectToAction("Index")); } catch (Exception e) { return(View()); } }