Refactor: pull out the dedup CAS (similar to the nonidem branch)
to get ready to try a few different options.

I can still produce the double-winner failure on AddRemoveTests/i1,
but it can take about 1500 runs of the test.