Udm::Object SFUtils::getTopArchetype( Udm::Object object ) {
    if ( object == Udm::null ) return object;

    Udm::Object archetype = object.archetype();
    while( archetype != Udm::null ) {
        object = archetype;
        archetype = object.archetype();
    }
    return object;
}
Udm::Object SFUtils::getTopLevelInstance( Udm::Object object ) {
    if ( object == Udm::null ) return Udm::null;

    Udm::Object parent = object.GetParent();

    Udm::Object archetype = parent.archetype();
    while( archetype != Udm::null ) {
        if (  ( object = object.archetype() ) == Udm::null  ) return Udm::null;
        parent = archetype;
        archetype = parent.archetype();
    }
    return object;
}