DSSSM-666 #time 21m Implementing functionality for handling sorting order