store groups on query