Groups controller refactoring

Moved queries and list helper functions out of the controller