* @param mapper The mapper.
*/
private <T extends Descriptor> void flushProperties(T descriptor, Node node, DescriptorMapper<T> mapper) {
Map<NodeProperty, Object> properties = mapper.getProperties(descriptor);
for (Entry<NodeProperty, Object> entry : properties.entrySet()) {
NodeProperty property = entry.getKey();
String name = property.name();
Object value = entry.getValue();
if (value == null) {
if (node.hasProperty(name)) {
node.removeProperty(name);
}
} else {
Object existingValue;
if (node.hasProperty(property.name())) {
existingValue = node.getProperty(name);
} else {
existingValue = null;
}
if (!value.equals(existingValue)) {