public function buildWidget(
        PropertyInterface $property,
        ModelInterface $model
    ) {
        if (static::$scopeDeterminator->currentScopeIsUnknown()
            || !static::$scopeDeterminator->currentScopeIsBackend()
        ) {
            throw new DcGeneralRuntimeException(
                \sprintf(
                    'WidgetBuilder only supports the backend mode. Running in mode "%s".',
                    static::$scopeDeterminator->currentScopeIsUnknown() ? 'unknown' : 'frontend'
                )
            );
        }

        $environment = $this->getEnvironment();
        $class       = $this->getWidgetClass($property);

        $prepareAttributes = $this->prepareWidgetAttributes($model, $property);
        $widget            = new $class($prepareAttributes, new DcCompat($environment, $model, $property->getName()));

        // OH: what is this? source: DataContainer 232.
        $widget->currentRecord = $model->getId();

        $widget->xlabel .= $this->getXLabel($property);

        $event = new ManipulateWidgetEvent($environment, $model, $property, $widget);
        $environment->getEventDispatcher()->dispatch(ManipulateWidgetEvent::NAME, $event);

        return $widget;
    }