public function update($columns)
    {
        static::checkReadOnly();

        if ($this->isFresh()) {
            $message = 'Can not update fresh Model: ' . static::class;
            throw new \LogicException($message);
        }

        $this->updateStampColumns($columns);

        $columns = (array) $columns;
        $data = Utils::arrayWhitelist($this->changes, $columns);
        $data = static::validate($data, false);

        $database = self::getDatabase();
        $stmt = $database->update(static::TABLE, $data, $this->getPrimaryKey());

        $error_code = $stmt->errorCode();
        if ($error_code == '00000') {
            $changes = Utils::arrayBlacklist($this->changes, $columns);
            $data = $this->getData();
            $where = Utils::arrayWhitelist($data, static::PRIMARY_KEY);
            if ($this->load($where)) {
                $this->changes = $changes;
                return true;
            }
            return false;
        }
        return $error_code;
    }