class NotificationCourseAccessManager implements CourseAccessManager {

    Map<Long, RepositoryEntry> getCoursesAccesibleForIdentity(List<NotificationSubscriptionContext> notificationCourseAccessTOs) {
        Set<Long> contextIdSet = new HashSet<Long>(); // caches all contextIds for a subscriber

        Map<Long, RepositoryEntry> onlyAccessibleCourses = new HashMap<Long, RepositoryEntry>();
        for (NotificationSubscriptionContext notificationCourseAccessTO : notificationCourseAccessTOs) {
            if (!contextIdSet.contains(notificationCourseAccessTO.getContextId())) {
                RepositoryEntry repositoryEntry = isCourseAccesibleForIdentity(notificationCourseAccessTO);
                contextIdSet.add(notificationCourseAccessTO.getContextId());
                if (repositoryEntry != null) {
                    onlyAccessibleCourses.put(notificationCourseAccessTO.getContextId(), repositoryEntry);
                }
            }
        }
        return onlyAccessibleCourses;
    }

      NotificationCourseAccessManager();

}