public async Task AddEntry(PhoneBookEntry entry) { var existingEntry = await phoneBookRepository.GetById(entry.Name.Trim()); if (existingEntry != null) { throw new ApplicationException("An entry with the same name already exists in this phone book. Please use another name or update the existing entry."); } var phoneBook = new PhoneBook(); phoneBook.AddEntry(entry); await phoneBookRepository.AddEntry(entry); }