protected function setPropertyValue($object, \ReflectionProperty $property, $value)
    {
        if ($value !== null) {
            // If the property is public accessible, set the value directly
            if ($property->isPublic()) {
                $object->{$property->name} = $value;
            } else {
                // If not, use the setter / adder
                $ucw = ucwords($property->name);
                if ($property->getDeclaringClass()->hasMethod($method = 'set' . $ucw)) {
                    $object->$method($value);
                } elseif ($property->getDeclaringClass()->hasMethod($method = 'add' . $ucw)) {
                    $object->$method($value);
                }
            }
        }
    }