Enhance select method

Enhancement for select method and many-to-many relationships.