try {
result.setContinue(false);
VersioningService versioningService = new DSpace().getSingletonService(VersioningService.class);
VersionHistory versionHistory = versioningService.findVersionHistory(context, itemId);
for (String id : versionIDs) {
versioningService.removeVersion(context, Integer.parseInt(id));
}
context.commit();
//Retrieve the latest version of our history (IF any is even present)
Version latestVersion = versionHistory.getLatestVersion();
if(latestVersion == null){
result.setParameter("itemID", null);
}else{
result.setParameter("itemID", latestVersion.getItemID());
}