Consider extracting a `SortOrder` object that can be queried rather than traversing an object in hash style