Implement detection of duplicated ESR records.

This is a backport of changes in vesr 0.13.0.