Groups routes refactoring

This PR moves the biggest pieces of logic within the Groups' routes to context object to give better readability to the routes and also to favor testability.

It also adds tests for groups routes and for groups context objects.
The main refactor is still a WIP, however I'd like to start reviewing and merging so impacts in the code base is as low as possible.