if (!ObjectUtils.equals(objectSiteMod.getOwner(), site)) {
trash(object, site, user);
return;
}
Database database = objectState.getDatabase();
UUID objectId = objectState.getId();
try {
database.beginWrites();
database.deleteByQuery(Query.from(Draft.class).where("objectId = ?", objectId));
database.deleteByQuery(Query.from(History.class).where("objectId = ?", objectId));
database.deleteByQuery(Query.from(Trash.class).where("objectId = ?", objectId));
objectState.delete();
database.commitWrites();
} finally {
database.endWrites();
}
}