Sorting an array of objects by a single key