How about using indexOfTopLevelItem to get the index ?