/**
  * Portfolio menu.
  *
  * @param sc Scanner to read user input from the command line.
  * @throws IOException If there is a problem communicating with the server.
  * @throws ServiceException If the service is unable to handle the request.
  */
 private static void portfolioMenu(FinanceService service, Scanner sc)
     throws IOException, ServiceException {
   printPortfolioMenuHelp();
   while (true) {
     String requestUrl = baseUrl + PORTFOLIO_FEED_URL_SUFFIX;
     switch (processPortfolioMenuCommand(sc.nextLine().toLowerCase())) {
       case QUERY_FEED:
         System.out.print("Include returns in query response? (y/n) ");
         String includeReturns = sc.nextLine();
         if (includeReturns.toLowerCase().equals("y")
             || includeReturns.toLowerCase().equals("yes")) {
           requestUrl += "?returns=true";
         } else if (includeReturns.toLowerCase().equals("n")
             || includeReturns.toLowerCase().equals("no")) {
           requestUrl += "?returns=false";
         }
         System.out.print("Inline positions in feed? (y/n) ");
         String inlinePositions = sc.nextLine();
         if (inlinePositions.toLowerCase().equals("y")
             || inlinePositions.toLowerCase().equals("yes")) {
           requestUrl += "&positions=true";
         } else if (inlinePositions.toLowerCase().equals("n")
             || inlinePositions.toLowerCase().equals("no")) {
           requestUrl += "&positions=false";
         }
         queryPortfolioFeed(service, requestUrl);
         break;
       case QUERY_ENTRY:
         System.out.println("Enter portfolio ID");
         portfolioIdProperty = sc.nextLine();
         requestUrl += "/" + portfolioIdProperty;
         queryPortfolioEntry(service, requestUrl);
         break;
       case CREATE:
         System.out.println("Enter portfolio name");
         String portfolioName = sc.nextLine();
         System.out.println("Enter currency code");
         String currencyCode = sc.nextLine();
         PortfolioEntry entry = FinanceUtilities.makePortfolioEntry(portfolioName, currencyCode);
         insertPortfolioEntry(service, requestUrl, entry);
         break;
       case UPDATE:
         System.out.println("Enter portfolio ID");
         portfolioIdProperty = sc.nextLine();
         requestUrl += "/" + portfolioIdProperty;
         System.out.println("Enter new portfolio name");
         portfolioName = sc.nextLine();
         System.out.println("Enter new currency code");
         currencyCode = sc.nextLine();
         entry = FinanceUtilities.makePortfolioEntry(portfolioName, currencyCode);
         updatePortfolioEntry(service, requestUrl, entry);
         break;
       case DELETE:
         System.out.println("Enter portfolio ID");
         portfolioIdProperty = sc.nextLine();
         requestUrl += "/" + portfolioIdProperty;
         deletePortfolioEntry(service, requestUrl);
         break;
       case BACK:
         return;
       case POSITIONS:
         positionMenu(service, sc);
         break;
       case QUIT:
         System.exit(0);
       case HELP:
         printPortfolioMenuHelp();
         break;
       default:
         printPortfolioMenuHelp();
     }
   }
 }