Refactoring: new graph class

Move messages selection from users_controller to a message scope
Move graph computation from users_controller to a new graph class