class ApplicationsAndBookmarkCleaner extends FixedHourScheduledJob {

    void removeOldBookmarksAndApplications() {
        var latestAccessIntervals = accessIntervalRepo.findAllLatestIntervals();

        for (AccessInterval interval : latestAccessIntervals) {
            if (interval.getEndTime().plusDays(28L).isBefore(LocalDateTime.now(clock))) {
                bookmarkService.removeAllBookmarksOfUser(interval.getUser());
                userService.removeAllApplicationsOfUser(interval.getUser());

                log.debug("deleted bookmarks and applications of user " + interval.getUser().getId());
            }
        }
    }

    @Autowired public  ApplicationsAndBookmarkCleaner(UserService userService,
                                          BookmarkService bookmarkService,
                                          AccessIntervalRepository accessIntervalRepo,
                                          Clock clock);

}