echo "<br /><br />\n\n" . $updateItemResponse->getStatus();
    echo "<br /><br />\n\n" . $updateItemResponse->getBody();
    die("Error updating Zotero item\n\n");
}
//replace the item in library->items with the api response
$updatedItem = new Zotero_Item($updateItemResponse->getBody());
$library->items->replaceItem($updatedItem);
echo "Item updated\n\n\n<br />";
//try to get the items we just created separately to make sure the api has them
//and they've been updated correctly
$existingItemKey = $existingItem->itemKey;
echo "getting existing item\n<br />";
$retrievedExistingItem = $library->loadItem($existingItemKey);
echo "got existing item\n<br />";
$diff = $existingItem->compareItem($retrievedExistingItem);
echo "difference between created item and retrieved item:\n<br />";
var_dump($diff);
if ($existingItem === $retrievedExistingItem) {
    echo "existingItem and retrievedExistingItem point to the same object\n<br />";
} else {
    echo "pointing to different items\n<br />";
}
echo "Deleting created item \n<br />";
$deleteResponse = $library->deleteItem($retrievedExistingItem);
if ($deleteResponse->isError()) {
    echo "Error deleting item: \n<br />";
    echo $deleteResponse->getStatus();
    echo $deleteResponse->getBody();
} else {
    echo "Item Deleted\n<br />";
}