public function commit()
    {
        try {
            $prepared = Agl::app()->getDb()->getConnection()->prepare("
                INSERT INTO
                    `" . $this->getDbPrefix() . $this->_dbContainer . "`
                (" . $this->_getFields() . ")
                VALUES
                (" . $this->_getPreparedFields() . ")
            ");

            if (! $prepared->execute($this->_fields)) {
                $error = $prepared->errorInfo();
                throw new Exception("The insert query failed (table '" . $this->getDbPrefix() . $this->_dbContainer . "') with message '" . $error[2] . "'");
            }

            if (Agl::app()->isDebugMode()) {
                Agl::app()->getDb()->incrementCounter();
            }

            $this->_setId(Agl::app()->getDb()->getConnection()->lastInsertId());

            return $prepared->rowCount();
        } catch (Exception $e) {
            throw new Exception($e);
        }

        return true;
    }