createDocument method now checks whether provided entity is MetadataAware