class JaxbUtil {

    public static void marshal(Object object, OutputStream outputStream) {
        try {
            MarshallerBuilder.create().build().marshal(object, outputStream);
        } catch (Throwable ex) {
            Optional<ConstraintViolationException> validationException = unwrapConstraintViolationException(ex);
            if (validationException.isPresent()) {
                throw validationException.get();
            }
            throw new ConfigException(ex);
        }
    }

    private  JaxbUtil();

}