Refactor DuplicateChecking