deleteAllRoomOccupations(); if (rooms != null) { associateRooms(rooms, period);
associateRooms(rooms, period);  final Set<RoomOccupation> roomOccupationsToDelete = new HashSet<RoomOccupation>(); for (final RoomOccupation roomOccupation : getAssociatedRoomOccupation()) { final Room room = roomOccupation.getRoom(); if (!rooms.contains(room)) { roomOccupationsToDelete.add(roomOccupation); } }  for (final RoomOccupation roomOccupation : roomOccupationsToDelete) { roomOccupation.delete();
    protected void setAttributesAndAssociateRooms(Date day, Date beginning, Date end,            List<ExecutionCourse> executionCoursesToAssociate,            List<CurricularCourseScope> curricularCourseScopesToAssociate, List<OldRoom> rooms,            OccupationPeriod period) {        checkValidHours(beginning, end);                this.setDayDate(day);        this.setBeginningDate(beginning);        this.setEndDate(end);        this.getAssociatedExecutionCourses().addAll(executionCoursesToAssociate);        this.getAssociatedCurricularCourseScope().addAll(curricularCourseScopesToAssociate);        deleteAllRoomOccupations();        if (rooms != null) {            associateRooms(rooms, period);        }    }