Remove code duplication in ProcessNonAggregatingGroupBy
Optimize code in ProcessNonAggregatingGroupBy