public void AddBook(Book book) { //TODO: validate if the user is admin // add new title if the title doesnt already exist if (!bookDao.CheckIfBookTitleExists(book.Title)) { //set default genre to General and default to 100 if (book.Genre.Count == 0) { AddTitle(book.Title, book.Author, book.Rating, book.Price == null ? 100 : book.Price, "General"); } else { AddTitle(book.Title, book.Author, book.Rating, book.Price == null ? 100 : book.Price, book.Genre[0]); //for multiple genres for (int i = 1; i < book.Genre.Count; i++) { bookDao.AddNewGenreToTitle(book.Title, book.Author, book.Genre[i]); } } } else { bookDao.AddBook(book.Title); } }