//Another method called DeleteDevFromTeam() public bool DeleteDevFromTeam(int Id, int teamid) { DeveloperRepo Repo = new DeveloperRepo(); Developer developer = Repo.GetDeveloperById(Id); if (developer == null) { return(false); } int initialcount = _devTeams.Count; //_devTeams.Remove(); //find the team that I want to delete a dev from use the team id and item id foreach (var item in _devTeams) { if (teamid == item.Id) { item.listOfDevelopers.Remove(developer); } } return(true); }