public function saveMessages()
    {
        if (!$this->getId()) {
            return $this->save();
        }

        $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
        /* @var $connection Varien_Db_Adapter_Interface */

        $count = $connection
            ->update(
                $this->getResource()->getMainTable(),
                array('messages' => $this->getMessages()),
                array('schedule_id = ?' => $this->getId())
            );

        if (!$count) {
            /**
             * Check if the row was not updated because of data truncation.
             */
            $warning = $this->_getPdoWarning($connection->getConnection());
            if ($warning && $warning->Code = 1265) {
                $maxLength = strlen($this->getMessages()) - 5000;
                $this->setMessages($warning->Level . ': ' .
                    str_replace(' at row 1', '.', $warning->Message) . PHP_EOL . PHP_EOL .
                    '...' . substr($this->getMessages(), -$maxLength));
            }
        }

        return $this;
    }