public function videoRecommendationsAction($scope = 'all', $groupingId = 'all', $debug = false)
 {
     $this->view->disable();
     // Get our context (this takes care of starting the session, too)
     $context = $this->getDI()->getShared('ltiContext');
     if (!$context->valid) {
         echo '[{"error":"Invalid lti context"}]';
         return;
     }
     if (!isset($groupingId)) {
         echo '[{"error":"No scope grouping ID specified"}]';
         return;
     }
     // Get the list of videos associated with concepts for the given scope and grouping ID
     $videos = [];
     switch ($scope) {
         case "concept":
             // Filter based on concept
             $videos = MappingHelper::videosForConcept($groupingId);
             break;
         case "unit":
             // Filter based on unit
             $videos = MappingHelper::videosForConcepts(MappingHelper::conceptsInUnit($groupingId));
             break;
         default:
             // All videos
             $videos = MappingHelper::videosForConcepts(MappingHelper::allConcepts());
             break;
     }
     // Find percentage watched for each video
     foreach ($videos as $key => $video) {
         $percentageWatched = MasteryHelper::calculateUniqueVideoPercentageForVideo($context->getUserName(), $video, $debug);
         // Add the percentage to the video
         $video["percentageWatched"] = $percentageWatched;
         // Add the modified video back to the original array
         $videos[$key] = $video;
     }
     // Format each video for the frontend
     $formatted = [];
     foreach ($videos as $video) {
         $formatted[] = $video;
     }
     if ($debug) {
         echo "<pre>Getting information for these video IDs in scope {$scope} and ID {$groupingId}\n";
         foreach ($videos as $video) {
             echo $video["Video ID"] . "\n";
         }
     }
     echo json_encode($formatted);
 }