Extract a function to select collection