* @param existing element to remove index entries
* @param indexName name of index associated to element
*/
public static <Type extends Element> void removeFromIndex(Graph database, Type existing, IndexNames indexName) {
if (database instanceof IndexableGraph) {
IndexableGraph indexable = (IndexableGraph) database;
if(indexName.isUsable()) {
Index<Type> index = (Index<Type>) indexable.getIndex(indexName.getIndexName(), indexName.getIndexed());
for(String propertyName : existing.getPropertyKeys()) {
index.remove(propertyName, existing.getProperty(propertyName), existing);
}
}
}