code: private static void marshalField(PropertyMetadata propertyMetadata, Object target,
        BaseEntity.Builder<?, ?> entityBuilder) {
      Object fieldValue = IntrospectionUtils.getFieldValue(propertyMetadata, target);
      if (fieldValue == null && propertyMetadata.isOptional()) {
        return;
      }
      ValueBuilder<?, ?, ?> valueBuilder = propertyMetadata.getMapper().toDatastore(fieldValue);
      // ListValues cannot have indexing turned off. Indexing is turned on by
      // default, so we don't touch excludeFromIndexes for ListValues.
      if (valueBuilder.getValueType() != ValueType.LIST) {
        valueBuilder.setExcludeFromIndexes(!propertyMetadata.isIndexed());
      }
      Value<?> datastoreValue = valueBuilder.build();
      entityBuilder.set(propertyMetadata.getMappedName(), datastoreValue);
      Indexer indexer = propertyMetadata.getSecondaryIndexer();
      if (indexer != null) {
        entityBuilder.set(propertyMetadata.getSecondaryIndexName(), indexer.index(datastoreValue));
      }
    }
docs: Marshals the field with the given property metadata.
  
  @param propertyMetadata
  the metadata of the field to be marshaled.
  @param target
  the object in which the field is defined/accessible from
  @param entityBuilder
  the native entity on which the marshaled field should be set