When replacing the whole document, ensure the deleted lines have IsDeleted set to true.