public function transform($data)
    {
        if ($data instanceof FormBuilder) {
            $response = $data->getRawResponse();

            foreach ($response['fieldsets'] as $fieldset) {
                $this->transformFieldset($fieldset);
            }

            return [
                'form' => [
                    'name'      => array_get($response, 'name'),
                    'rules'     => array_get($response, 'rules', []),
                    'fieldsets' => $this->fieldsets,
                ],
            ];
        }

        return parent::transform($data);
    }