Let's say you have a Classroom entity with an collection of Student entities. What I usually do when creating a new Student and need to add it to the Classroom is use Classroom.Students.Add(newStudent), now when I want to update this collection I normally clear() the collection and add the students again, something like:
theClassroom.Students.Clear();
foreach(Student student in updatedStudentsCollection) {
theClassroom.Students.Add(student);
}
Clearing the collection and adding the entities again feels somewhat quirky, so I guess there should be a better strategy for this scenario. Please share how do you normally handle this.