private Error NewPortfolio(PortfolioEvent e)
 {
     try
     {
         _mainModel.Account.CreatePortfolio(e.PortfolioName, _mainModel.VerifyStock);
         _currentPortfolio = _mainModel.Account.GetPortfolioByName(e.PortfolioName);
         Broadcast(new PortfolioEvent("portfolio", _currentPortfolio.Name));
     }
     catch (ArgumentException err)
     {
         return(new Error(err.Message));
     }
     return(Error.None);
 }
 private Error DeletePortfolio(PortfolioEvent e)
 {
     try
     {
         _mainModel.Account.DeletePortfolio(e.PortfolioName, _mainModel.Stocks);
     }
     catch (ArgumentException err)
     {
         return(new Error(err.Message));
     }
     _currentPortfolio = null;
     Broadcast(new PortfolioEvent("portfolio", ""));
     return(Error.None);
 }
 private Error ViewPortfolio(PortfolioEvent e)
 {
     if (_mainModel.Account.Portfolios.Exists((p) => p.Name == e.PortfolioName))
     {
         _currentPortfolio = _mainModel.Account.GetPortfolioByName(e.PortfolioName);
     }
     else
     {
         return(new Error("No portfolio exists with that name."));
     }
     if (_currentPortfolio != null)
     {
         Broadcast(new PortfolioEvent("portfolio", _currentPortfolio.Name));
     }
     else
     {
         Broadcast(new PortfolioEvent("portfolio", ""));
     }
     return(Error.None);
 }