// 2d) check if rules have been removed, and remove them if necessary from the database
PreparedStatement deleteProgramRule = getPreparedStatement("programs.delete_rule");
PreparedStatement deleteRule = getPreparedStatement("rules.delete_by_id");
synchronized (deleteProgramRule) {
deleteProgramRule.clearBatch();
deleteRule.clearBatch();
for(Rule oldRule : old.getRules()) {
if(!program.getRules().contains(oldRule)) {
deleteProgramRule.setLong(1,old.getId());
deleteProgramRule.setLong(2,oldRule.getId());
deleteProgramRule.addBatch();