public function toAssoc()
    {
        $params = [];
        foreach (Extract::getObjectVars($this) as $key => $value) {
            if (!$value instanceof Relation) {
                $params[$key] = $value;
            }
        }
        if ($this->getPrimaryKeyValue() === null) {
            unset($params[$this->getPrimaryKey()]);
        }
        return $params;
    }