* @param mapper The mapper.
*/
private <T extends Descriptor> void flushRelations(T descriptor, Node node, DescriptorMapper<T> mapper) {
Map<Relation, Set<? extends Descriptor>> relations = mapper.getRelations(descriptor);
for (Entry<Relation, Set<? extends Descriptor>> relationEntry : relations.entrySet()) {
Relation relationType = relationEntry.getKey();
Set<? extends Descriptor> targetDescriptors = relationEntry.getValue();
if (!targetDescriptors.isEmpty()) {
Set<Node> existingTargetNodes = new HashSet<>();
Iterable<Relationship> relationships = node.getRelationships(relationType, Direction.OUTGOING);
if (relationships != null) {