Move idAttr back inside loop

Taking into consideration a collection can have different model types in it which the idAttr lookup needs to take into account