Helper to easily sort a table