Adding GROUP by support to the model.