public static InternalFactHandle[] orderFacts(ObjectStore objectStore) {
    // this method is just needed for testing purposes, to allow round tripping
    int size = objectStore.size();
    InternalFactHandle[] handles = new InternalFactHandle[size];
    int i = 0;
    for (Iterator<?> it = objectStore.iterateFactHandles(); it.hasNext(); ) {
      handles[i++] = (InternalFactHandle) it.next();
    }

    Arrays.sort(handles, new HandleSorter());

    return handles;
  }