public ActionResult ChangeBroker(string newBroker, int oldBrokerID, int interactionID) { Interaction i = intRepo.GetInteractionById(interactionID); Broker oldB = brokerRepo.GetBrokerByID(oldBrokerID); Broker newB = brokerRepo.GetBrokerByEmail(newBroker); if (i != null && oldB != null && newB != null) { oldB.Interactions.Remove(i); newB.Interactions.Add(i); brokerRepo.UpdateBroker(oldB); brokerRepo.UpdateBroker(newB); return(RedirectToAction("BrokerInteractions", new { BrokerID = oldBrokerID })); } else { ModelState.AddModelError("", "Interaction or broker Not Found"); } return(RedirectToAction("BrokerInteractions", new { BrokerID = oldBrokerID })); }