TEIID-3119 updating dup removal to use tree logic