* then save the original defect again.
*/
Defect existingDefect = validator.getLastExistingDefect();
Date originalLastModified = existingDefect.getLastModifiedDate();
DefectChangeset changeset = new DefectChangeset();
// core should make sure the session user exists
// if this can't find the user, something's horribly wrong
changeset.setUser((User) db.retrieve(User.class, "username", session.getUsername()).get(0));
ChangesetCallback callback = new ChangesetCallback(changeset);
// copy values to old defect and fill in our changeset appropriately
updateMapper.map(updatedDefect, existingDefect, callback);
if(changeset.getChanges().size() == 0) {
// stupid user didn't even change anything!
// don't bother saving to database, reset last modified date
existingDefect.setLastModifiedDate(originalLastModified);
} else {
// add changeset to Defect events, save to database