Made more robust the saving of metadata to a page, especially when handling duplicates.