public async Task<ActionResult> Market()
        {
            MarketViewModel marketModel = new MarketViewModel()
            {
                AvailableMarkets = await DataContext.Market.ListAvailableMarkets(),
                TopMarkets = await DataContext.Market.ListTopMarkets()
            };

            if (!marketModel.TopMarkets.Any())
            {
                marketModel.SetProcessState(
                    new Model.ProcessState(FeatureDemandPlanning.Model.Enumerations.ProcessStatus.Warning, "No markets configured"));
            }
            else
            {
                marketModel.SetProcessState(
                    new Model.ProcessState(FeatureDemandPlanning.Model.Enumerations.ProcessStatus.Information, String.Format("{0} markets configured", marketModel.TopMarkets.Count())));
            }

            return View("Market", marketModel);
        }
        public async Task<ActionResult> AddTopMarket(int marketId)
        {
            var marketModel = new MarketViewModel();
            try
            {
                marketModel.AvailableMarkets = await DataContext.Market.ListAvailableMarkets();
                marketModel.TopMarkets = await DataContext.Market.ListTopMarkets();

                var addedMarket = DataContext.Market.AddTopMarket(marketId);

                marketModel.AvailableMarkets = await DataContext.Market.ListAvailableMarkets();
                marketModel.TopMarkets = await DataContext.Market.ListTopMarkets();

                marketModel.SetProcessState(new Model.ProcessState(FeatureDemandPlanning.Model.Enumerations.ProcessStatus.Success,
                String.Format("Market '{0}' was added successfully", addedMarket.Name)));
            }
            catch (ApplicationException ex)
            {
                marketModel.SetProcessState(ex);
            }

            return Json(marketModel);
        }
        public async Task<ActionResult> DeleteTopMarket(int marketId)
        {
            MarketViewModel marketModel = new MarketViewModel();

            try
            {
                marketModel.AvailableMarkets = await DataContext.Market.ListAvailableMarkets();
                marketModel.TopMarkets = await DataContext.Market.ListTopMarkets();

                var deletedMarket = DataContext.Market.DeleteTopMarket(marketId);

                marketModel.AvailableMarkets = await DataContext.Market.ListAvailableMarkets();
                marketModel.TopMarkets = await DataContext.Market.ListTopMarkets();

                if (!marketModel.TopMarkets.Any())
                {
                    marketModel.SetProcessState(new Model.ProcessState(FeatureDemandPlanning.Model.Enumerations.ProcessStatus.Warning,
                     "No markets configured"));
                }
                else
                {
                    marketModel.SetProcessState(new Model.ProcessState(FeatureDemandPlanning.Model.Enumerations.ProcessStatus.Success,
                    String.Format("Market '{0}' was deleted successfully", deletedMarket.Name)));
                }

            }
            catch (ApplicationException ex)
            {
                marketModel.SetProcessState(ex);
            }

            return Json(marketModel);
        }