public static Set<IDWithIssuer> pidsOf(Attributes attrs) {
        IDWithIssuer pid = IDWithIssuer.pidOf(attrs);
        Sequence opidseq = attrs.getSequence(Tag.OtherPatientIDsSequence);
        if (opidseq == null || opidseq.isEmpty())
            if (pid == null)
                return Collections.emptySet();
            else
                return Collections.singleton(pid);
        
        Set<IDWithIssuer> pids = new LinkedHashSet<>((1 + opidseq.size()) << 1);
        if (pid != null)
            pids.add(pid);
        for (Attributes item : opidseq)
            addTo(IDWithIssuer.pidOf(item), pids);
        return pids;
    }
@Test
    public void no_main_id_returns_all() {
        Attributes rootWithMainId = createIdWithNS(NS);

        rootWithMainId.newSequence(OtherPatientIDsSequence, 0);
        Sequence other = rootWithMainId.getSequence(OtherPatientIDsSequence);

        Attributes otherPatientId = otherPatientIds("other_ns");
        other.add(otherPatientId);

        Set<IDWithIssuer> all = IDWithIssuer.pidsOf(rootWithMainId);

        assertEquals("Same pid but for different issuer should not be removed!", all.size(), 2);
    }