Refactored sorting code to remove duplicated code.

Using the to_sym function was able to convert RESTful URL parameter
into column name for sort. Instead of 4 nearly identical sort routines,
now there is just one generic one.