Fixed validation logic for adding duplicate books