protected function entityToArray(): array
    {
        $array = [
                "id" => (string) $this->id,
                "label" => $this->label(),
                "attributes" => $this->attributes->toArray()
        ];
        if(isset($this->listeners)&&isset($this->listeners_flat)) {
            $array["listeners"] = $this->listeners_flat;
        }
        return $array;
    }