private <T> Object doSet(String name, Object value, ModelProperty<T> property) {
ModelSchema<T> propertySchema = property.getSchema();
MutableModelNode propertyNode = modelNode.getLink(name);
propertyNode.ensureUsable();
if (propertySchema instanceof ManagedImplSchema) {
<BUG>if (value == null) {</BUG>
if (propertySchema instanceof ScalarCollectionSchema) {
<BUG>ScalarCollectionSchema.clear(propertyNode);
} else {
propertyNode.setTarget(null);
}</BUG>
} else if (ManagedInstance.class.isInstance(value)) {

private <T> Object doSet(String name, Object value, ModelProperty<T> property) {
ModelSchema<T> propertySchema = property.getSchema();
MutableModelNode propertyNode = modelNode.getLink(name);
propertyNode.ensureUsable();
if (propertySchema instanceof ManagedImplSchema) {
if (propertySchema instanceof ScalarCollectionSchema) {
ModelView<? extends Collection<?>> modelView = propertyNode.asMutable(COLLECTION_MODEL_TYPE, ruleDescriptor);
return ((ScalarCollectionModelView<?, ? extends Collection<?>>) modelView).setValue(value);
} else if (value == null) {
propertyNode.setTarget(null);
} else if (ManagedInstance.class.isInstance(value)) {
