Refactored repositories controller.

Signed off by: Daniel Bucher <daniel.bucher88@gmail.com>