code: static void writeCertificates(final ModelNode result, final Certificate[] certificates) throws CertificateEncodingException, NoSuchAlgorithmException {
          if (certificates != null) {
              for (Certificate current : certificates) {
                  ModelNode certificate = new ModelNode();
                  writeCertificate(certificate, current);
                  result.add(certificate);
              }
          }
      }
docs: Populate the supplied response with the model representation of the certificates.
  
  @param result the response to populate.
  @param certificates the certificates to add to the response.
  @throws CertificateEncodingException
  @throws NoSuchAlgorithmException