protected function checkPropertyValue($object, $propertyName, array $propertyMetaData)
    {
        $propertyValue = ObjectAccess::getProperty($object, $propertyName, true);
        $propertyType = $propertyMetaData['type'];
        if ($propertyType === 'ArrayObject') {
            throw new PersistenceException('ArrayObject properties are not supported - missing feature?!?', 1283524355);
        }

        if (is_object($propertyValue)) {
            if ($propertyType === 'object') {
                if (!($propertyValue instanceof PersistenceMagicInterface)) {
                    throw new IllegalObjectTypeException('Property of generic type object holds "' . get_class($propertyValue) . '", which is not persistable (no entity or value object), in ' . get_class($object) . '::' . $propertyName, 1283531761);
                }
            } elseif (!($propertyValue instanceof $propertyType)) {
                throw new UnexpectedTypeException('Expected property of type ' . $propertyType . ', but got ' . get_class($propertyValue) . ' for ' . get_class($object) . '::' . $propertyName, 1244465558);
            }
        } elseif ($propertyValue !== null && $propertyType !== $this->getType($propertyValue)) {
            throw new UnexpectedTypeException('Expected property of type ' . $propertyType . ', but got ' . gettype($propertyValue) . ' for ' . get_class($object) . '::' . $propertyName, 1244465559);
        }

        return $propertyValue;
    }