Integrate logic to support sort and sort direction on endpoints