update metadata handling and have deleteDocument return the list of all items deleted