private function mapElements(array $elements, array $mainElements, array &$map, array &$inverse): void
    {
        foreach ($elements as $index => $element) {
            $elementId = (int) $element['id'];
            if (!array_key_exists($index, $mainElements)) {
                $this->logger->warning(
                    'Content element {id} has no mapping in main. Element skipped.',
                    [
                        'id' => $elementId,
                        'msg_type' => 'article_content_no_main',
                    ]
                );
                continue;
            }
            $mainElement = $mainElements[$index];
            $mainId      = (int) $mainElement['id'];
            if ($element['type'] !== $mainElement['type']) {
                $this->logger->warning(
                    'Content element {id} has different type as element in main. Element skipped.',
                    [
                        'id' => $elementId,
                        'mainId' => $mainId,

                        'msg_type' => 'article_content_type_mismatch'
                    ]
                );
                continue;
            }

            $map[$elementId]  = $mainId;
            $inverse[$mainId] = $elementId;
        }
    }