handleVersioningBeforeWrite(op, entity, false, "deleting");
// first handle any dependent deletes that need deleting before we delete this object
ClassLoaderResolver clr = ec.getClassLoaderResolver();
DatastoreClass dc = datastoreMgr.getDatastoreClass(op.getObject().getClass().getName(), clr);
DependentDeleteRequest req = new DependentDeleteRequest(dc, op.getClassMetaData(), clr);
Set relatedObjectsToDelete = req.execute(op, entity);
Key keyToDelete = EntityUtils.getPkAsKey(op);
// If we're in the middle of a batch operation just register the key that needs the delete
BatchDeleteManager bdm = getBatchDeleteManager(ec);