private void dispatcherForOption(
     InputOutput inputOutput, Library library, int menuOption, User whoIsLogin) {
   if ("user".equals(whoIsLogin.getRoll()) && menuOption > 8) {
     inputOutput.printInvalidOptionMessage();
   } else
     switch (menuOption) {
       case 1:
         inputOutput.printBooksOnConsole(library.allAvailableBooks);
         break;
       case 2:
         inputOutput.printEnterBookName();
         if (library.checkOutBook(whoIsLogin.getUserId(), inputOutput.readStringFromConsole())) {
           inputOutput.printThankYouEnjoyTheBook();
         } else {
           inputOutput.printThatBookIsNotAvailableMessage();
         }
         break;
       case 3:
         inputOutput.printEnterBookName();
         if (library.checkInBooks(whoIsLogin.getUserId(), inputOutput.readStringFromConsole())) {
           inputOutput.printThankYouForReturningTheBook();
         } else {
           inputOutput.printThatIsNotAValidBookToReturn();
         }
         break;
       case 4:
         inputOutput.printMoviesOnConsole(library.allAvailableMovies);
         break;
       case 5:
         inputOutput.printEnterMovieName();
         if (library.checkOutMovie(whoIsLogin.getUserId(), inputOutput.readStringFromConsole())) {
           inputOutput.printThankYouEnjoyTheMovie();
         } else {
           inputOutput.printThatMovieIsNotAvailable();
         }
         break;
       case 6:
         inputOutput.printEnterMovieName();
         if (library.checkInMovie(whoIsLogin.getUserId(), inputOutput.readStringFromConsole())) {
           inputOutput.printThankYouForReturningTheMovie();
         } else {
           inputOutput.printThatMovieIsNotAvailableToReturn();
         }
         break;
       case 7:
         inputOutput.printUserInfoOnConsole(whoIsLogin.toString());
         break;
       case 8:
         break;
       case 9:
         for (String userId : library.issuedBooksByUsers.keySet()) {
           inputOutput.printUserInfoOnConsole(
               userId + " - " + library.issuedBooksByUsers.get(userId).getNameOfBook());
         }
         break;
       case 10:
         for (String userId : library.issuedMoviesByUsers.keySet()) {
           inputOutput.printUserInfoOnConsole(
               userId + " - " + library.issuedMoviesByUsers.get(userId).getMovieName());
         }
         break;
       default:
         inputOutput.printInvalidOptionMessage();
     }
 }
 public void start() throws Exception {
   int menuOption = 1;
   while (menuOption != 2) {
     inputOutput.printLogInQuit();
     menuOption = inputOutput.readInputFromConsole();
     switch (menuOption) {
       case 1:
         inputOutput.printEnterLoginId();
         User whoIsLogin =
             login.logIn(inputOutput.readStringFromConsole(), inputOutput.readPassword());
         if (whoIsLogin.getRoll().equals("user")) {
           while (menuOption != 8) {
             inputOutput.printMenuOnConsoleForUser();
             inputOutput.printEnterYourChoice();
             menuOption = inputOutput.readInputFromConsole();
             dispatcherForOption(inputOutput, library, menuOption, whoIsLogin);
           }
         } else if (whoIsLogin.getRoll().equals("librarian")) {
           while (menuOption != 8) {
             inputOutput.printMenuOnConsoleForAdmin();
             inputOutput.printEnterYourChoice();
             menuOption = inputOutput.readInputFromConsole();
             dispatcherForOption(inputOutput, library, menuOption, whoIsLogin);
           }
         } else {
           inputOutput.printValidationProblem();
         }
         break;
       case 2:
         System.exit(0);
       default:
         inputOutput.printInvalidOptionMessage();
     }
   }
 }