added SortByFields function to sort SOArray