code: private void marshalVersionField() {
      PropertyMetadata versionMetadata = entityMetadata.getVersionMetadata();
      if (versionMetadata != null) {
        long version = (long) IntrospectionUtils.getFieldValue(versionMetadata, entity);
        ValueBuilder<?, ?, ?> valueBuilder = versionMetadata.getMapper().toDatastore(version + 1);
        valueBuilder.setExcludeFromIndexes(!versionMetadata.isIndexed());
        entityBuilder.set(versionMetadata.getMappedName(), valueBuilder.build());
      }
    }
docs: Marshals the version field, if it exists. The version will be set to one more than the previous
  value.