/**
   * Saves the configuration files of the auxiliar folder to an static one
   *
   * @param idUser
   * @param idProject
   * @param idConfig
   * @return
   */
  @RequestMapping(method = RequestMethod.POST, value = "/saveConfigurationFiles")
  public ResponseEntity<String> saveConfigurationFiles(
      @RequestParam("idUser") String idUser,
      @RequestParam("idProject") String idProject,
      @RequestParam("idConfig") String idConfig) {

    try {
      // Rename auxiliar folder to IdProject/idConfiguration (1/2)
      // This files will be used by Butler builder
      String folderAux = idUser + "/aux";
      File folder = new File(folderAux);
      File folderProject = new File(idUser + "/" + idProject);
      if (!folderProject.exists()) Files.createDirectory(folderProject.toPath());
      File folderConfig = new File(idUser + "/" + idProject + "/" + idConfig);
      // if exist delete it (old bad config)
      try {
        FileUtils.deleteDirectory(folderConfig);
      } catch (Exception e) {
        log.warn("Old config folder not deleted:" + e.getMessage());
      }

      folder.renameTo(folderConfig);
      log.info("Configuration saved: " + idUser);
      // Now you have to validate the project
      String command =
          "java -jar ../butler.jar do config --file "
              + folderConfig.getPath()
              + "/dsl.yml --idProject "
              + idProject
              + "_"
              + idConfig;

      log.info("Command: " + command);
      BufferedReader out = ops.executeCommand(command, false);
      String lineOut;
      String errorMessage = "";
      boolean error = true;
      while ((lineOut = out.readLine()) != null) {
        errorMessage = lineOut;
        if ((lineOut.contains("successfully"))) {
          error = false;
        }
      }
      // if its not valid, throw an error
      if (error) {
        log.warn("Not valid DSL: " + errorMessage);
        throw new InternalError("Not valid DSL: " + errorMessage);
      }

    } catch (Exception e) {
      log.warn("Configuration not saved:" + e.getMessage());
      throw new InternalError("Error saving: " + e.getMessage());
    }
    return new ResponseEntity<>("saved", HttpStatus.OK);
  }