/**
  * Hide expired lessons
  * Hides all lesson which meet the given constraints. Returns a query result with matching lessons.
  *
  * @param boolean $dryRun
  * @return \TYPO3\CMS\Extbase\Persistence\Generic\QueryResult | NULL
  */
 protected function hideExpiredLessons($dryRun)
 {
     $demand = $this->createDemandForExpiredLessons();
     $lessons = $this->lessonRepository->findDemanded($demand);
     if (!$dryRun) {
         foreach ($lessons as $lesson) {
             $lesson->setHidden(1);
             $this->lessonRepository->update($lesson);
         }
     }
     return $lessons;
 }