Implement named scope and order by.