public <DataType> void updateSingle(AbstractBluePrintsBackedFinderService<? extends Graph, DataType, ?> service, Graph database, Property p, Object toUpdate, Vertex rootVertex, CascadeType cascade, Map<String, Object> objectsBeingAccessed) {
Object value = p.get(toUpdate);
// As a convention, null values are never stored
if(value!=null) {
Vertex valueVertex = service.getVertexFor(value, cascade, objectsBeingAccessed);
Edge link = null;
// Get previously existing vertex
String edgeNameFor = GraphUtils.getEdgeNameFor(p);
Iterator<Edge> existingIterator = rootVertex.getOutEdges(edgeNameFor).iterator();
// property is single-valued, so iteration can be done at most one
if(existingIterator.hasNext()) {
// There is an existing edge, change its target and maybe delete previous one
Edge existing = existingIterator.next();
if(existing.getInVertex().equals(valueVertex)) {
// Nothing to do
link = existing;
} else {
// delete old edge (TODO maybe delete vertex, if there is no other link (excepted obvious ones, like type, Object.classes, and id)
database.removeEdge(existing);