static String parentId(Scope scope, String id) { if (!scope.models.containsKey(id)) return id; return scope.models[id]!.parent?.id ?? id; }