public function lastId($field = null) {
        try {
            $this->checkDialect();
        } catch (\Exception $e) {
            $this->error = $e->getMessage();

            return 0;
        }

        return $this->dialect->lastInsertId($field);
    }