// Check whether there is a counterpart in the last file
int lastIdx = lastCompleteFile.getProgramFrameIndexForId(newFrame.getId());
if (lastIdx == -1) {
// There is no counterpart -> this is an insert
ProgramFrame insertFrame = (ProgramFrame) newFrame.clone();
updateFile.addProgramFrame(insertFrame);
} else {
// There is a counterpart -> this is an update
// -> Determine the changed fields and add them
ProgramFrame lastFrame = lastCompleteFile.getProgramFrameAt(lastIdx);
ProgramFrame updateFrame = createUpdateFrame(lastFrame, newFrame);