Refactor apply_order and apply_filter
Refactor apply_order and apply_filter

The old methods were too long and complex, so I rewrote them in a more
composed and functional manner without breaking the API.

bluerail/crud_toolbox,bluerail/crud_toolbox