Move duplicate check into FileHistoryDao.