Fix duplicate database entries when editing

When editing a book and the barcode is changed, it no longer creates a duplicate entry in the database.