Implementing the removeBookCollection method

This next method is straightforward:

removeBookCollection(identifier: string): void {
if (!identifier) {
throw new Error("An identifier must be provided");
}

this._bookCollections.delete(identifier);
this._view.removeBookCollection(identifier);
this._bookService.removeMediaCollection(identifier).then(() => {
console.log("Removed the collection with identifier: ",
identifier);
}).catch(_ => {
this._view.displayErrorMessage("Failed to remove the
collection!"
);
});
}

This method first makes sure that an identifier is provided. Then, it deletes the corresponding key from the map, tells the view to remove it as well, and, finally, invokes the corresponding service method.

In the event of an error, the view is asked to display an error message.