Refactor ReposController

move querying logic to responsible models.
added tests

Feedback ? :smiley: 

Thanks!