maintain db consistency when deleting papers