public function buildMessage(ParserInterface $parser, \Swift_Message $messageInstance, $useFallbackTemplate = true)
    {
        // Set mail template, and save the current template
        $parser->pushTemplateDefinition(
            $parser->getTemplateHelper()->getActiveMailTemplate(),
            $useFallbackTemplate
        );

        $subject     = $parser->renderString($this->getSubject());
        $htmlMessage = $this->getHtmlMessageBody($parser);
        $textMessage = $this->getTextMessageBody($parser);

        $messageInstance->setSubject($subject);

        // If we do not have an HTML message
        if (empty($htmlMessage)) {
            // Message body is the text message
            $messageInstance->setBody($textMessage, 'text/plain');
        } else {
            // The main body is the HTML messahe
            $messageInstance->setBody($htmlMessage, 'text/html');

            // Use the text as a message part, if we have one.
            if (! empty($textMessage)) {
                $messageInstance->addPart($textMessage, 'text/plain');
            }
        }

        // Restore previous template
        $parser->popTemplateDefinition();

        return $messageInstance;
    }