Source:
public Response updateChildrenBulk(@Context HttpServletRequest request, String content) { Response response; if (StringUtils.isNotBlank(content)) { try { JsonObject jsonObj = (JsonObject) new JsonParser().parse(content); int totalItemCount = 0; JsonObject updateItems = jsonObj.getAsJsonObject("data"); Set<Entry<String, JsonElement>> entrySet = updateItems.entrySet(); int itemCount = entrySet.size(); totalItemCount += itemCount; if (itemCount > 0) { Map<String, JsonObject> itemMap = new HashMap<>(); for (Entry<String, JsonElement> entry : entrySet) { itemMap.put(entry.getKey(), (JsonObject) entry.getValue()); } if (!updateItemChildren(itemMap)) { response = Response.serverError().build(); log.error("An error occurred while updating items! Skipping deletes."); return response; } } else { log.info("Incoming content had no item updates"); } JsonArray deleteNoChildren = jsonObj.getAsJsonArray("deleteNoChildren"); itemCount = deleteNoChildren.size(); totalItemCount += itemCount; if(!deleteItems(deleteNoChildren, false)){ response = Response.serverError().build(); log.error("An error occurred while deleteing items and orphaning children! Skipping deletes with children."); return response; } JsonArray deleteWithChildren = jsonObj.getAsJsonArray("deleteWithChildren"); itemCount = deleteWithChildren.size(); totalItemCount += itemCount; if(!deleteItems(deleteWithChildren, true)){ response = Response.serverError().build(); log.error("An error occurred while deleteing items and children!"); return response; } if(totalItemCount == 0){ log.error("Incoming content had no items."); response = Response.status(Response.Status.BAD_REQUEST).build(); } response = Response.ok().build(); } catch (JsonSyntaxException ex) { log.error("Could not parse incoming content: {}", content, ex); response = Response.status(Response.Status.BAD_REQUEST).build(); } } else { log.error("Incoming content was empty"); response = Response.status(Response.Status.BAD_REQUEST).build(); } return response; }

Target:
public Response updateChildrenBulk(@Context HttpServletRequest request, String content) { Response response; if (StringUtils.isNotBlank(content)) { try { JsonObject jsonObj = (JsonObject) new JsonParser().parse(content); int totalItemCount = 0; JsonObject updateItems = jsonObj.getAsJsonObject("data"); Set<Entry<String, JsonElement>> entrySet = updateItems.entrySet(); int itemCount = entrySet.size(); totalItemCount += itemCount; if (itemCount > 0) { Map<String, JsonObject> itemMap = new HashMap<>(); for (Entry<String, JsonElement> entry : entrySet) { itemMap.put(entry.getKey(), (JsonObject) entry.getValue()); } if (!updateItemChildren(itemMap)) { response = Response.serverError().build(); log.error("An error occurred while updating items! Skipping deletes."); return response; } } else { log.info("Incoming content had no item updates"); } JsonArray deleteNoChildren = jsonObj.getAsJsonArray("deleteNoChildren"); itemCount = deleteNoChildren.size(); totalItemCount += itemCount; if(!deleteItems(deleteNoChildren, false)){ response = Response.serverError().build(); log.error("An error occurred while deleteing items and orphaning children! Skipping deletes with children."); return response; } JsonArray deleteWithChildren = jsonObj.getAsJsonArray("deleteWithChildren"); itemCount = deleteWithChildren.size(); totalItemCount += itemCount; if(!deleteItems(deleteWithChildren, true)){ response = Response.serverError().build(); log.error("An error occurred while deleteing items and children!"); return response; } if(totalItemCount == 0){ log.error("Incoming content had no items."); response = Response.status(Response.Status.BAD_REQUEST).build(); return response; } response = Response.ok().build(); } catch (JsonSyntaxException ex) { log.error("Could not parse incoming content: {}", content, ex); response = Response.status(Response.Status.BAD_REQUEST).build(); } } else { log.error("Incoming content was empty"); response = Response.status(Response.Status.BAD_REQUEST).build(); } return response; }