Fix repo controller behavior for unfound repos

GET requests for /repository/with_agent/:id were raising a 500 when the id didn't exist. Fixed by using to_jsonmodel method as on other controllers.