public static boolean putOAuthApplicationData(OAuthApp oAuthApp)
      throws DynamicClientRegistrationException {
    boolean status = false;
    try {
      if (log.isDebugEnabled()) {
        log.debug("Persisting OAuth application data in Registry");
      }
      StringWriter writer = new StringWriter();
      JAXBContext context = JAXBContext.newInstance(OAuthApp.class);
      Marshaller marshaller = context.createMarshaller();
      marshaller.marshal(oAuthApp, writer);

      Resource resource = DynamicClientWebAppRegistrationUtil.getGovernanceRegistry().newResource();
      resource.setContent(writer.toString());
      resource.setMediaType(DynamicClientRegistrationConstants.ContentTypes.MEDIA_TYPE_XML);
      String resourcePath =
          DynamicClientRegistrationConstants.OAUTH_APP_DATA_REGISTRY_PATH
              + "/"
              + oAuthApp.getWebAppName();
      status = DynamicClientWebAppRegistrationUtil.putRegistryResource(resourcePath, resource);
    } catch (RegistryException e) {
      throw new DynamicClientRegistrationException(
          "Error occurred while persisting OAuth application data : " + oAuthApp.getClientName(),
          e);
    } catch (JAXBException e) {
      e.printStackTrace();
    }
    return status;
  }