/**
  * Review answers.
  *
  * @param \_OurBrand_\Quiz\Domain\Model\Exercise $exercise
  * @param \_OurBrand_\Quiz\Domain\Model\StudentQuizSession $studentQuizSession
  */
 public function reviewAction($exercise, $studentQuizSession)
 {
     $randomShapes = $exercise->getRandomShapes();
     $utility = new Utility();
     // Create array with correctAnswers in same format as $answerData.
     $correctAnswers = array();
     foreach ($randomShapes as $shape) {
         $correctAnswers[$utility->getSaltedString($this->persistenceManager->getIdentifierByObject($shape))] = $this->persistenceManager->getIdentifierByObject($shape);
     }
     // get previous saved answers
     $answers = $this->answerRepository->findBySessionAndExercise($studentQuizSession, $exercise)->getFirst();
     $answerData = array();
     if (is_a($answers, '\\_OurBrand_\\Quiz\\Domain\\Model\\Answer')) {
         $answerData = unserialize($answers->getAnswerDatas()->first()->getData());
         $userAnswersStatus = array('correct' => array(), 'false' => array());
         // save the correct answer here as well
         foreach ($answerData as $saltedUuid => $uuid) {
             if (isset($correctAnswers[$saltedUuid]) && $correctAnswers[$saltedUuid] === $uuid) {
                 $userAnswersStatus['correct'][] = $uuid;
             } else {
                 $userAnswersStatus['false'][] = $uuid;
             }
         }
     }
     $this->view->assign('shapes', $randomShapes);
     $this->view->assign('userAnswers', json_encode($answerData));
     $this->view->assign('userAnswersStatus', json_encode($userAnswersStatus));
     $this->view->assign('correctAnswers', json_encode($correctAnswers));
     $this->view->assign('explanationTranslateKey', 'exerciseType.matchPictureInPicture.explanation');
     $this->view->assign('currentExercise', $exercise);
     $this->view->assign('quiz', $exercise->getQuiz());
     $this->view->assign('session', $studentQuizSession);
 }