public function handle(BuildWidgetEvent $event)
    {
        $environment = $event->getEnvironment();
        if (($environment->getDataDefinition()->getName() !== 'tl_metamodel_dcasetting')
            || ($event->getProperty()->getName() !== 'mandatory')
            || (null === $event->getModel()->getId())) {
            return;
        }

        $model     = $event->getModel();
        $metaModel = $this->getMetaModelFromModel($model);
        $attribute = $metaModel->getAttributeById($model->getProperty('attr_id'));
        if (null === $attribute) {
            return;
        }

        if ($attribute->get('isunique')) {
            Message::addInfo(
                $this->translator->trans(
                    'tl_metamodel_dcasetting.mandatory_for_unique_attr',
                    [],
                    'contao_tl_metamodel_dcasetting'
                )
            );

            $extra = $event->getProperty()->getExtra();

            $extra['disabled'] = true;

            $event->getProperty()->setExtra($extra);

            $model->setProperty('mandatory', true);
        }
    }