//rotate first
Set<Map.Entry<String, Object>> entrySet = new TreeMap<String, Object>(edits).entrySet();
for (Map.Entry<String, Object> entry : entrySet) {
if (entry.getKey().equals("rotate")) {
item = realEditor.edit(item, entry.getKey(), null, entry.getValue());
}
}
for (Map.Entry<String, Object> entry : entrySet) {
if (!entry.getKey().equals("rotate")) {
item = realEditor.edit(item, entry.getKey(), null, entry.getValue());