Changed variable name isSubDocument to isEmbeddedDocument