@RequestMapping(value = "/connect", method = RequestMethod.POST, consumes = "application/json")
  public ResponseEntity newUser(@RequestBody String data) {
    Gson gson = new Gson();
    User user = gson.fromJson(data, User.class);

    LOGGER.info(user.toString());

    if (userRepository.findByFacebookId(user.getFacebookId()) != null) {

      return new ResponseEntity<>(
          userRepository.findByFacebookId(user.getFacebookId()), HttpStatus.OK);

    } else {

      User newUser = userRepository.save(User.newUser(user));
      ArrayList<Profession> profession = new ArrayList<Profession>();

      for (Occupation occupation : occupationRepository.findAll()) {
        profession.add(new Profession(occupation, -1.0 /* myCareerUtils.randInt(-1, 5)*/));
      }

      newUser.setProfessions(profession);

      return new ResponseEntity<>(userRepository.save(newUser), HttpStatus.OK);
    }
  }
  @RequestMapping(value = "/trending", method = RequestMethod.GET)
  public ResponseEntity<ArrayList<Trending>> getTrending() {

    List<User> userList = userRepository.findAll();
    List<Occupation> occupationList = occupationRepository.findAll();

    ArrayList<Trending> trending = ClusterUtils.getTrendingOccupations(userList, occupationList);
    Collections.sort(trending);

    return new ResponseEntity<>(trending, HttpStatus.OK);
  }
 @RequestMapping(value = "/getOccupation", method = RequestMethod.GET)
 public ResponseEntity<Occupation> getOccupation(@RequestParam("id") String id) {
   return new ResponseEntity<>(occupationRepository.findOne(id), HttpStatus.OK);
 }