code: @SuppressWarnings("unchecked")
      public static Map<String, AttributeValue> getItemFromObject(final DynamoDBPersistable dynamoDBPersistable) {
          Map<String, AttributeValue> itemMap = new HashMap<String, AttributeValue>();
  
          for (Iterator<String> dirtyFields = dynamoDBPersistable.__getDirtyFields(); dirtyFields.hasNext(); ) {
              String dirtyField = dirtyFields.next();
              Object object = dynamoDBPersistable.__get(dirtyField);
  
              // We don't save nulls.  If it turns out we need it, we could have a "saveNulls" configuration value.
              // If saveNulls and attributeValue == null: itemMap.put(dirtyField, new AttributeValue().withNULL(Boolean.TRUE));
              // Note we might want something like a thread local 'PersistenceContext' with saveNulls or have a
              // DynamoDBPersistable.saveNulls(saveNulls) method
              if (object != null) {
                  itemMap.put(dirtyField, toAttributeValue(object));
              }
          }
  
          return itemMap;
      }
docs: -------------------------------------------------------------