code: public static EscMeta createEscMeta(@NotNull final SerializerRegistry registry, @NotNull final EnhancedMimeType targetContentType,
              @Nullable final CommonEvent commonEvent) {
  
          Contract.requireArgNotNull("registry", registry);
          Contract.requireArgNotNull("targetContentType", targetContentType);
  
          if (commonEvent == null) {
              return null;
          }
  
          final String dataType = commonEvent.getDataType().asBaseType();
          final Serializer dataSerializer = registry.getSerializer(new SerializedDataType(dataType));
          final EnhancedMimeType dataContentType = contentType(dataSerializer.getMimeType(), targetContentType);
  
          if (commonEvent.getMeta() == null) {
              return new EscMeta(dataType, dataContentType);
          }
  
          final String metaType = commonEvent.getMetaType().asBaseType();
          final SerializedDataType serDataType = new SerializedDataType(metaType);
          final Serializer metaSerializer = registry.getSerializer(serDataType);
          if (metaSerializer.getMimeType().matchEncoding(targetContentType)) {
              return new EscMeta(dataType, dataContentType, metaType, metaSerializer.getMimeType(), commonEvent.getMeta());
          }
  
          final byte[] serMeta = metaSerializer.marshal(commonEvent.getMeta(), serDataType);
          final EnhancedMimeType metaContentType = contentType(metaSerializer.getMimeType(), targetContentType);
          return new EscMeta(dataType, dataContentType, metaType, metaContentType, new Base64Data(serMeta));
  
      }
docs: Create meta information for a given a {@link CommonEvent}.
  
  @param registry
  Registry with serializers.
  @param targetContentType
  Content type that will later be used to serialize the created result.
  @param commonEvent
  Event to create meta information for.
  
  @return New meta instance.