Added the groupByKeyPath method.