@Override
  public void insertOrUpdatePreferences(EasitApplicationPreferences preferences, EasitAccount user)
      throws Exception {

    // Convert the prefs to
    String strPrefs = localPrefsToServerPrefs(preferences);

    // Prepare request and send it
    DefaultHttpClient client = new DefaultHttpClient();
    StringEntity input = new StringEntity(strPrefs);
    input.setContentEncoding("UTF8");
    input.setContentType("application/json");

    HttpPost postRequest =
        new HttpPost(
            environment.getProperty("flowManager.url") + "/oldpreferences/" + user.getUserToken());
    postRequest.setEntity(input);
    HttpResponse response = client.execute(postRequest);

    // NOT Correct answer
    if (response.getStatusLine().getStatusCode() != 200) {
      logger.info("ERROR:");
      logger.info(
          "URL target"
              + environment.getProperty("flowManager.url")
              + "/oldpreferences/"
              + user.getUserToken());
      throw new Exception("Failed : HTTP error code : " + response.getStatusLine().getStatusCode());
    }

    // Clear connection
    client.getConnectionManager().shutdown();
  }