Convert extensionIds to a list. You enumerate below more than once for avaiableId and extensionList.