/**
  * @param DOMDocument $dom
  * @param WpProQuiz_Model_Question $question
  * @return DOMDocument
  */
 private function createQuestionElement($dom, $question)
 {
     $qElement = $dom->createElement('question');
     $qElement->setAttribute('answerType', $question->getAnswerType());
     $qElement->appendChild($title = $dom->createElement('title'));
     $title->appendChild($dom->createCDATASection($question->getTitle()));
     $qElement->appendChild($dom->createElement('points', $question->getPoints()));
     $qElement->appendChild($questionText = $dom->createElement('questionText'));
     $questionText->appendChild($dom->createCDATASection($question->getQuestion()));
     $qElement->appendChild($correctMsg = $dom->createElement('correctMsg'));
     $correctMsg->appendChild($dom->createCDATASection($question->getCorrectMsg()));
     $qElement->appendChild($incorrectMsg = $dom->createElement('incorrectMsg'));
     $incorrectMsg->appendChild($dom->createCDATASection($question->getIncorrectMsg()));
     $qElement->appendChild($tipMsg = $dom->createElement('tipMsg'));
     $tipMsg->setAttribute('enabled', $this->booleanToTrueOrFalse($question->isTipEnabled()));
     $tipMsg->appendChild($dom->createCDATASection($question->getTipMsg()));
     $qElement->appendChild($dom->createElement('category', $question->getCategoryName()));
     $qElement->appendChild($dom->createElement('correctSameText', $this->booleanToTrueOrFalse($question->isCorrectSameText())));
     $qElement->appendChild($dom->createElement('showPointsInBox', $this->booleanToTrueOrFalse($question->isShowPointsInBox())));
     $qElement->appendChild($dom->createElement('answerPointsActivated', $this->booleanToTrueOrFalse($question->isAnswerPointsActivated())));
     $qElement->appendChild($dom->createElement('answerPointsDiffModusActivated', $this->booleanToTrueOrFalse($question->isAnswerPointsDiffModusActivated())));
     $qElement->appendChild($dom->createElement('disableCorrect', $this->booleanToTrueOrFalse($question->isDisableCorrect())));
     $answersElement = $dom->createElement('answers');
     $answerData = $question->getAnswerData();
     if (is_array($answerData)) {
         foreach ($answerData as $answer) {
             /** @var WpProQuiz_Model_AnswerTypes $answer */
             $answerElement = $dom->createElement('answer');
             $answerElement->setAttribute('points', $answer->getPoints());
             $answerElement->setAttribute('correct', $this->booleanToTrueOrFalse($answer->isCorrect()));
             $answerText = $dom->createElement('answerText');
             $answerText->setAttribute('html', $this->booleanToTrueOrFalse($answer->isHtml()));
             $answerText->appendChild($dom->createCDATASection($answer->getAnswer()));
             $answerElement->appendChild($answerText);
             $sortText = $dom->createElement('stortText');
             $sortText->setAttribute('html', $this->booleanToTrueOrFalse($answer->isSortStringHtml()));
             $sortText->appendChild($dom->createCDATASection($answer->getSortString()));
             $answerElement->appendChild($sortText);
             $answersElement->appendChild($answerElement);
         }
     }
     $qElement->appendChild($answersElement);
     return $qElement;
 }