Implement serialization of SortOptions.