private static int findModuleEntryIndex(ModifiableRootModel model, Module module) {
    OrderEntry[] entries = model.getOrderEntries();
    for (int i = 0; i < entries.length; i++) {
      OrderEntry entry = entries[i];
      if (entry instanceof ModuleOrderEntry && module.equals(((ModuleOrderEntry)entry).getModule())) {
        return i;
      }
    }
    return -1;
  }
private static int findModuleEntryIndex(ModifiableRootModel model, Module module)