public function asArray()
    {
        $data = [];
        $columns = Manager::getInstance()->get($this)->getColumns();
        foreach(array_keys($columns) as $field) {
            $data[trim($field, '_')] = $this->$field;
        }
        $relations = Manager::getInstance()->get($this)->getRelations();
        foreach(array_keys($relations) as $field) {
            if ($this->$field instanceof Entity) {
                $data[trim($field, '_')] = $this->$field->asArray();
            } elseif ($this->$field instanceof RecordList) {
                $values = [];
                /** @var Entity $entity */
                foreach ($this->$field as $entity) {
                    $values[] = $entity->asArray();
                }
                $data[trim($field, '_')] = $values;
            } else {
                $data[trim($field, '_')] = $this->$field;
            }
        }
        return $data;

    }