// sort entities for insertion
List sorted = new ArrayList(entities);
EntitySorter sorter = new AshwoodEntitySorter();
sorter.setDataMaps(destinationNode.getDataMaps());
sorter.sortDbEntities(sorted, false);
if (cleaningDestination) {
// reverse insertion order for deletion
List entitiesInDeleteOrder = new ArrayList(sorted.size());
entitiesInDeleteOrder.addAll(sorted);