protected function addMessages($method, array $messages)
    {
        // If there was exactly 1 message, it wasn't put in an array of messages.
        if (array_key_exists('code', $messages)) {
            $messages = array($messages);
        }
        foreach ($messages as $message) {
            call_user_func(array($this, $method), $message);
        }
        return $this;
    }