public function buildByType(AbstractType $type, $formData, $locale, $attributes)
    {
        $config = $this->create($locale);
        $config->setFileFields(array_fill_keys($type->getFileFields(), $type->getCollectionId()));

        $attributes['form'] = [
            'data' => $formData,
        ];

        $adminMailConfiguration = $this->buildAdminMailConfigurationByTypeAndData(
            $type,
            $formData,
            $locale,
            $attributes
        );
        $websiteMailConfiguration = $this->buildWebsiteMailConfigurationByTypeAndData(
            $type,
            $formData,
            $locale,
            $attributes
        );

        $config->setAdminMailConfiguration($adminMailConfiguration);
        $config->setWebsiteMailConfiguration($websiteMailConfiguration);

        return $config;
    }