This is insertion sort that is O(n*n) but it performs better
1. if the array is partially sorted (second sort is cheap)
2. there are few elements, we expect to have only a handful of them per widget
3. stable, which is handy for duplicate attributes, e.g. we can choose which one to pick
https://en.wikipedia.org/wiki/Insertion_sort