protected function build(IMetaModelDataDefinition $container)
    {
        $inputScreen = $this->viewCombination->getScreen($container->getName());
        if (!$inputScreen) {
            return;
        }

        if ($container->hasPropertiesDefinition()) {
            $definition = $container->getPropertiesDefinition();
        } else {
            $definition = new DefaultPropertiesDefinition();
            $container->setPropertiesDefinition($definition);
        }

        $metaModel = $this->factory->getMetaModel($container->getName());

        // If the current metamodel has variants add the varbase and vargroup to the definition.
        if ($metaModel->hasVariants()) {
            // These are not properties yet, therefore we have to work around.
            $this->getOrCreateProperty($definition, 'varbase');
            $this->getOrCreateProperty($definition, 'vargroup');
        }

        $properties = [];
        foreach ($inputScreen['properties'] as $property) {
            if ('attribute' !== $property['dcatype']) {
                continue;
            }
            $properties[$property['attr_id']] = $property;
        }

        foreach ($metaModel->getAttributes() as $attribute) {
            if (!isset($properties[$attribute->get('id')])) {
                continue;
            }
            $this->buildProperty(
                $definition,
                $attribute,
                $attribute->getFieldDefinition($properties[$attribute->get('id')])
            );

            $event = new BuildAttributeEvent($metaModel, $attribute, $container);
            $this->dispatcher->dispatch($event::NAME, $event);
        }
    }