docs: public static Attachment writeAttachment(byte[] attachment, String title, String type) throws IOException {
          String name = generateAttachmentName();
          String extension = getExtensionByMimeType(type);
          String source = name + extension;
  
          File file = new File(getResultsDirectory(), source);
          synchronized (ATTACHMENTS_LOCK) {
              if (!file.exists()) {
                  try (FileOutputStream fos = new FileOutputStream(file)) {
                      fos.write(attachment);
                  }
              }
          }
          return new Attachment().withTitle(title).withSource(source).withType(type);
      }