Bug found and fixed

If order bys were null exception was thrown while building the criteria.
It's been fixed to ignore null order bys
Refactor and tests