Added support for group by in model.