TRUNK-3850 Program validator is inefficient when checking for duplicates