public void setBuildpack(String buildpack) {
    Staging staging = deploymentInfo.getStaging();

    String existingStartCommand = staging != null ? staging.getCommand() : null;
    staging = new Staging(existingStartCommand, buildpack);
    deploymentInfo.setStaging(staging);
  }
  public void createApplication(
      String appName,
      Staging staging,
      int memory,
      List<String> uris,
      List<String> serviceNames,
      boolean checkExists) {
    if (checkExists) {
      try {
        getApplication(appName);
        return;
      } catch (HttpClientErrorException e) {
        if (e.getStatusCode() != HttpStatus.NOT_FOUND) {
          throw e;
        }
      }
    }

    if (serviceNames == null) {
      serviceNames = new ArrayList<String>();
    }
    CloudApplication payload =
        new CloudApplication(
            appName,
            staging.getRuntime(),
            staging.getFramework(),
            memory,
            1,
            uris,
            serviceNames,
            CloudApplication.AppState.STOPPED);
    payload.setCommand(staging.getCommand());
    getRestTemplate().postForLocation(getUrl("apps"), payload);
    CloudApplication postedApp = getApplication(appName);
    if (serviceNames != null && serviceNames.size() != 0) {
      postedApp.setServices(serviceNames);
      updateApplication(postedApp);
    }
  }