code: public void save(File file) throws IOException {
          try {
              BufferedWriter writer = new BufferedWriter(new FileWriter(file));
              
              boolean needLineBreakForGroup = false;
              boolean needLineBreakForItem = false;
              for (QueryControllerEntity entity : queryController.getElements()) {
                  if (entity instanceof QueryControllerGroup) {
                      if (needLineBreakForGroup) {
                          writer.write("\n");
                      }
                      writeQueryGroup((QueryControllerGroup) entity, writer);
                      needLineBreakForGroup = true;
                  } else if (entity instanceof QueryControllerQuery) {
                      if (needLineBreakForItem) {
                          writer.write("\n");
                      }
                      writeQueryItem((QueryControllerQuery) entity, writer);
                      needLineBreakForItem = true;
                      needLineBreakForGroup = true;
                  }
              }
              writer.flush();
              writer.close();
          } catch (IOException e) {
              throw new IOException(String.format("Error while saving the queries to file located at %s.\n" +
                      "Make sure you have the write permission at the location specified.", file.getAbsolutePath()));
          }
      }
docs: The save/write operation.
  
  @param file
  The target file object to which the queries are saved.
  @throws IOException