@Override
  public void serialize(Json json) throws IOException {
    json.writeMapBegin();
    json.writeMapEntry("descriptor", descriptor);

    AuraContext context = Aura.getContextService().getCurrentContext();
    if (!context.isPreloading() && !context.isPreloaded(getDescriptor())) {
      // TODONM: revisit this after removing theme from aura context
      if (context.getThemeList().isEmpty()) {
        context.addAppThemeDescriptors();
      }
      json.writeMapEntry("code", getCode());
    }
    json.writeMapEnd();
  }