protected function setLdapValueForProperty(\ReflectionProperty $property, LdapObjectAnnotation $annotation, $entity)
    {
        $value = $property->getValue($entity);

        if ($value instanceof LdapObject) {
            $ldapValues = $value->get($annotation->id);
        } elseif ($value instanceof LdapObjectCollection) {
            $ldapValues = [];
            foreach ($value->toArray() as $ldapObject) {
                $ldapValues[] = $ldapObject->get($annotation->id);
            }
        } else {
            throw new \InvalidArgumentException(sprintf(
                'Class "%s" is not valid. Expected a LdapObject or LdapObjectCollection',
                get_class($value)
            ));
        }

        $property->setValue($entity, $ldapValues);
    }