protected function mapToProperty($property, $value, $xmlEntry, $entity, $stackEntity)
    {
        $classSchema = $this->reflectionService->getClassSchema(get_class($entity));

        if ($classSchema->hasProperty($property)) {
            $propertyDefinition = $classSchema->getProperty($property);

            switch (true) {
                    case is_a($propertyDefinition['type'], \TYPO3\CMS\Extbase\Persistence\ObjectStorage::class, true):

                        foreach ($xmlEntry->children() as $xmlChildEntry) {
                            $name = $xmlChildEntry->getName();
                            $childEntity = new $propertyDefinition['elementType']();
                            $entityForTagName = $this->getEntityForTagName($childEntity, $xmlEntry, $name, $stackEntity);

                            if (is_a($entityForTagName, $propertyDefinition['elementType'], true)) {
                                $entity->_getProperty($property)->attach($childEntity);
                            }

                            $this->mapXMLElementToEntity($xmlChildEntry, $entityForTagName, $stackEntity);
                        }

                        break;
                    case is_a($propertyDefinition['type'], \TYPO3\CMS\Extbase\DomainObject\AbstractEntity::class, true):

                        $subEntity = $entity->_getProperty($property);
                        if (!$subEntity) {
                            $subEntity = new $propertyDefinition['type']();
                            $entity->_setProperty($property, $subEntity);
                        }

                        $this->mapXMLElementToEntity($xmlEntry, $subEntity, $stackEntity);
                        break;
                    case is_a($propertyDefinition['type'], \DateTime::class, true):

                        if (!empty($value)) {
                            $dateTime = new \DateTime($value);
                            $entity->_setProperty($property, $dateTime);
                        }

                        break;

                    default:
                        $entity->_setProperty($property, $value);
            }

            return true;
        } else {
            return false;
        }
    }