add sortByAttributes for collection