Changed this and made the grouping happen in service call