code: @Nullable
      public static SerializedData serialize(@NotNull final SerializerRegistry registry, @NotNull final SerializedDataType type,
              @Nullable final Object data) {
  
          if (data == null) {
              return null;
          }
  
          Contract.requireArgNotNull("registry", registry);
          Contract.requireArgNotNull("type", type);
  
          final Serializer serializer = registry.getSerializer(type);
          return new SerializedData(type, serializer.getMimeType(), serializer.marshal(data, type));
      }
docs: Tries to find a serializer for the given type of object and converts it into a storable data block.
  
  @param registry
  Registry with known serializers.
  @param type
  Type of event.
  @param data
  Event of the given type.
  
  @return Event ready to persist or <code>null</code> if the given data was <code>null</code>.