static A replaceConceptAndUpdateRefs(Concept a, A b) { assertTrue("object to replace with must be unlisted", isUnlisted(b)); Concepts cc = a.concepts(); assertTrue("object to replace must be listed", cc != null); L refs = allBackRefObjects(a); b.id = a.id; deleteConcept(a); cc.register_phase2(b); cset(a, meta_migratedTo := b); // for objects that may have had direct pointers for (Concept.Ref ref : refs) ref.set(b); ret b; }