// TODO Change this to use EntrySet in the future.
// EntrySet.iterator().remove() doesn't seem to feed through to the DB at the moment
Map copy = new HashMap(map);
// Delete any keys that are no longer in the Map
Iterator attachedIter = copy.entrySet().iterator();
while (attachedIter.hasNext())
{
Map.Entry entry = (Map.Entry) attachedIter.next();
Object key = entry.getKey();
if (!keysValues.containsKey(key))