public Node createNodeUnlessExists(Key key, NodeLabel label) {
Map<String, Object> parameters = new HashMap<String, Object>( key.getColumnNames().length );
StringBuilder query = new StringBuilder( "MERGE" );
appendNodePattern( key, parameters, query, label );
query.append( " RETURN n" );
ExecutionResult result = engine.execute( query.toString(), parameters );
ResourceIterator<Node> column = result.columnAs( "n" );
Node node = null;
if ( column.hasNext() ) {
node = column.next();
}
column.close();