This function should have the same parameter ordering as createDocument, for consistency.