public function getMessages($clear = false) {
        $messages = $this->getData('messages');
        if ( ! is_array($messages)) {
            $messages = array();
        }
        return $messages;
    }