fixed entity_to_docs() to correctly build the list of docs to return