Sort array by cohort