/**
  * Posts a new message to the conversation
  * @param $conversationId int the id of the conversation
  * @param $message string the content of the message
  */
 public function newMessage($conversationId, $message)
 {
     try {
         DatabaseProvider::connection()->beginTransaction();
         DatabaseProvider::connection()->execute(self::UPDATE_MESSAGE_POSTED, ['message' => $message, 'conversation' => $conversationId, 'user' => Authentication::getInstance()->getUserId()]);
         $userModel = new UserModel();
         $doc = new \DOMDocument();
         $doc->load($this->conversationFolder . $conversationId . '.xml');
         $messageNode = $doc->createElement('message');
         $messageNode->appendChild($doc->createElement('author', Authentication::getInstance()->getUserId()));
         $messageNode->appendChild($doc->createElement('authorName', $userModel->getUserFullName(Authentication::getInstance()->getUserId())));
         $messageNode->appendChild($doc->createElement('date', date('c')));
         $contentNode = $doc->createElement('content');
         $contentNode->appendChild($doc->createCDATASection($message));
         $messageNode->appendChild($contentNode);
         $doc->firstChild->appendChild($messageNode);
         $doc->save($this->conversationFolder . $conversationId . '.xml');
         DatabaseProvider::connection()->commit();
     } catch (Exception $e) {
         DatabaseProvider::connection()->rollBack();
         throw $e;
     }
 }