code: public static XContentBuilder marshall(ContractBean bean) throws StorageException {
          try (XContentBuilder builder = XContentFactory.jsonBuilder()) {
              preMarshall(bean);
              builder
                  .startObject()
                      .field("id", bean.getId())
                      .field("clientOrganizationId", bean.getClient().getClient().getOrganization().getId())
                      .field("clientOrganizationName", bean.getClient().getClient().getOrganization().getName())
                      .field("clientId", bean.getClient().getClient().getId())
                      .field("clientName", bean.getClient().getClient().getName())
                      .field("clientVersion", bean.getClient().getVersion())
                      .field("apiOrganizationId", bean.getApi().getApi().getOrganization().getId())
                      .field("apiOrganizationName", bean.getApi().getApi().getOrganization().getName())
                      .field("apiId", bean.getApi().getApi().getId())
                      .field("apiName", bean.getApi().getApi().getName())
                      .field("apiVersion", bean.getApi().getVersion())
                      .field("apiDescription", bean.getApi().getApi().getDescription())
                      .field("planName", bean.getPlan().getPlan().getName())
                      .field("planId", bean.getPlan().getPlan().getId())
                      .field("planVersion", bean.getPlan().getVersion())
                      .field("createdOn", bean.getCreatedOn().getTime())
                      .field("createdBy", bean.getCreatedBy())
                  .endObject();
              postMarshall(bean);
              return builder;
          } catch (IOException e) {
              throw new StorageException(e);
          }
      }
docs: Marshals the given bean into the given map.
  @param bean the bean
  @return the content builder
  @throws StorageException when a storage problem occurs while storing a bean