class CourseSynchronizer {

    public SynchronizedGroupStatistic synchronizeCourse(CampusCourseImportTO sapCourse) {
        if (sapCourse != null) {
            long resourceableId = sapCourse.getOlatResourceableId();
            log.debug("synchronizeCourse sapCourseId=" + sapCourse.getSapCourseId() + "  resourceableId=" + resourceableId);
            ICourse course = CourseFactory.loadCourse(resourceableId);
            commitDBImplTransaction();
            log.debug("synchronizeCourse start for course=" + course.getCourseTitle());
            log.debug("synchronizeCourse Lecturer size=" + sapCourse.getLecturers().size());
            log.debug("synchronizeCourse Participants size=" + sapCourse.getParticipants().size());

            courseGroupSynchronizer.addAllLecturesAsOwner(course, sapCourse.getLecturers());
            // SynchronizedGroupStatistic groupStatistic = courseGroupSynchronizer.synchronizeCourseGroupsForStudentsOnly(course, sapCourse);
            SynchronizedGroupStatistic groupStatistic = courseGroupSynchronizer.synchronizeCourseGroups(course, sapCourse);
            commitDBImplTransaction();
            log.debug("synchronizeCourse statistic=" + groupStatistic);
            if (campusConfiguration.isSynchronizeTitleAndDescriptionEnabled()) {
                log.debug("SynchronizeTitleAndDescription is enabled");
                courseAttributeSynchronizer.synchronizeTitleAndDescription(sapCourse.getSapCourseId(), sapCourse);
                commitDBImplTransaction();
            }
            return groupStatistic;
        } else {
            return SynchronizedGroupStatistic.createEmptyStatistic();
        }
    }

}