protected function addInstance(Message $message, $type, $flash = true, $format = null)
    {
        $message->setType($type);
        if ($message->isFlash() != $flash) {
            $message->setFlash($flash);
        }
        if (is_null($message->getFormat())) {
            $message->setFormat($this->getFormat($type));
        }
        if (!is_null($format)) {
            $message->setFormat($this->checkFormat($format, $type));
        }
    }