Generalize the ordering functions for sorting the resources
Move `order-by` and related functions over to `utils` namespace