public HomePageViewModel Build(int itemId) { _magazineService.IncreaseNumOfView(itemId); var cats = _magazineService.GetCategories(); var mainViewModel = new HomePageViewModel(); var headerViewModel = new HeaderViewModel(); var footerViewModel = new FooterViewModel(); var mainPageViewModel = new MainPageViewModel(); if (cats != null && cats.Any()) { headerViewModel.Categories = cats.ToList(); footerViewModel.Categories = cats.ToList(); } mainPageViewModel.LeftColumn = BindingDataForDetailsLeftColumnViewModel(itemId); mainPageViewModel.RightColumn = BindingDataForMainPageRightColumnViewModel(); headerViewModel.SiteTitle = string.Format("Magazine Website - {0}", ((DetailsLeftColumnViewModel)mainPageViewModel.LeftColumn).CurrentItem.ItemContent.Title); mainViewModel.Header = headerViewModel; mainViewModel.DashBoard = new DashboardViewModel(); mainViewModel.Footer = footerViewModel; mainViewModel.MainPage = mainPageViewModel; return(mainViewModel); }