public function encodeMessage($message, $queue)
    {
        $messageFactory = $this->getMessageFactory();

        if (!$this->messageFactory->accepts($message)) {
            throw new Exception\RuntimeException(
                sprintf(
                    '%s does not accept message of type "%s"',
                    get_class($messageFactory),
                    (is_object($message) ? get_class($message) : gettype($message))
                )
            );
        }

        return new BernardDefaultMessage(
            $queue,
            array(
                self::MESSAGE_CLASS_KEY => get_class($message),
                self::MESSAGE_KEY => $this->getMessageFactory()->toArray($message),
            )
        );
    }