public void update(Instructor instructor, List<Long> ids) { List<Course> courses = this.courseDao.getByIds(ids); Set<Course> coursesSet = new HashSet<>(courses); instructor.setCourses(coursesSet); this.update(instructor); }