Insert a new id into the indexMap, shifting indices as needed. Returns the correct index where it should be placed.