public function toArray(): array
    {
        $config = [
            'fields' => $this->getFields(),
        ];

        if ($this->config->has('key')) {
            $config['key'] = $this->getKey();
        } else {
            $config['key'] = Key::generate($this->getKey(), 'group');
        }

        return array_merge($this->config->toArray(), $config);
    }