/**
  * Iterates through all the projects and updates them with the current state of the data sheet
  * This is a helper method needed if the the separately persisted properties changed in the model
  */
 public function updateAllProjectsAction()
 {
     $this->checkAdministratorAndDenyIfNeeded();
     $projects = $this->projectRepository->findAll();
     $i = 0;
     foreach ($projects as $project) {
         $i++;
         /** @var \GIB\GradingTool\Domain\Model\Project $project */
         $project->setDataSheetContent($project->getDataSheetContentArray());
         $project->setProjectData($project->getProjectDataArray());
         $this->projectRepository->update($project);
         if ($i % 20 == 0) {
             // persist after each 20th project
             $this->persistenceManager->persistAll();
         }
     }
     // persist after the last bunch of projects
     $this->persistenceManager->persistAll();
     // add a flash message
     $message = new \TYPO3\Flow\Error\Message('All projects updated.', \TYPO3\Flow\Error\Message::SEVERITY_OK);
     $this->flashMessageContainer->addMessage($message);
     $this->redirect('settings', 'Admin');
 }