moving order by field check logic within Query builder Class