function bigbluebuttonbn_getRecordingsImportedAllInstancesArray($recordID)
{
    $recordings_imported = bigbluebuttonbn_getRecordingsImportedAllInstances($recordID);
    $recordings_imported_array = bigbluebuttonbn_import_get_recordings_imported($recordings_imported);
    return $recordings_imported_array;
}
         error_log("ERROR: User not authorized to execute unpublish command");
         header("HTTP/1.0 401 Unauthorized. User not authorized to execute unpublish command");
     }
     break;
 case 'recording_delete':
     if ($bbbsession['managerecordings']) {
         //Retrieve the array of imported recordings
         $recordings_imported = bigbluebuttonbn_getRecordingsImportedArray($bbbsession['course']->id, isset($bbbsession['bigbluebuttonbn']) ? $bbbsession['bigbluebuttonbn']->id : NULL);
         $recordings_indexed = bigbluebuttonbn_index_recordings($recordings_imported);
         if (isset($recordings_indexed[$params['id']])) {
             // Execute unpublish on imported recording link
             bigbluebuttonbn_bbb_broker_do_delete_recording_imported($params['id'], $bbbsession['course']->id, $bbbsession['bigbluebuttonbn']->id);
         } else {
             // As the recordingid was not identified as imported recording link, execute delete on a real recording
             // First: Delete imported links associated to the recording
             $recordings_imported_all = bigbluebuttonbn_getRecordingsImportedAllInstances($params['id']);
             if (count($recordings_imported_all) > 0) {
                 foreach ($recordings_imported_all as $key => $record) {
                     // Execute delete
                     $DB->delete_records("bigbluebuttonbn_logs", array('id' => $key));
                 }
             }
             // Second: Execute the real delete
             $meeting_info = bigbluebuttonbn_bbb_broker_do_delete_recording($params['id']);
         }
         // Moodle event logger: Create an event for recording deleted
         if (isset($bigbluebuttonbn)) {
             bigbluebuttonbn_event_log(BIGBLUEBUTTON_EVENT_RECORDING_DELETED, $bigbluebuttonbn, $context, $cm);
         }
         $callback_response['status'] = "true";
         $callback_response_data = json_encode($callback_response);