/**
  * This function converts the submitted array and makes it ready it for storage
  *
  * Creating a single array of all question types including file id's to be stored
  * as comment meta by the calling function.
  *
  * @since 1.7.4
  * @access public
  *
  * @param array $unprepared_answers
  * @param $files
  * @return array
  */
 public static function prepare_form_submitted_answers($unprepared_answers, $files)
 {
     global $woothemes_sensei;
     $prepared_answers = array();
     // validate incoming answers
     if (empty($unprepared_answers) || !is_array($unprepared_answers)) {
         return false;
     }
     // Loop through submitted quiz answers and save them appropriately
     foreach ($unprepared_answers as $question_id => $answer) {
         //get the current questions question type
         $question_type = $woothemes_sensei->question->get_question_type($question_id);
         // Sanitise answer
         if (0 == get_magic_quotes_gpc()) {
             $answer = wp_unslash($answer);
         }
         // compress the answer for saving
         if ('multi-line' == $question_type) {
             $answer = esc_html($answer);
         } elseif ('file-upload' == $question_type) {
             $file_key = 'file_upload_' . $question_id;
             if (isset($files[$file_key])) {
                 $attachment_id = WooThemes_Sensei_Utils::upload_file($files[$file_key]);
                 if ($attachment_id) {
                     $answer = $attachment_id;
                 }
             }
         }
         // end if
         $prepared_answers[$question_id] = base64_encode(maybe_serialize($answer));
     }
     // end for each $quiz_answers
     return $prepared_answers;
 }