public ActionResult History(string path) { var item = PrimeViewBag(path).Last(); var history = _nodeProvider.GetRevisions(item); ViewBag.History = history; HistoryViewModel model; switch (history.Count) { case 0: model = new HistoryViewModel(0, 0); break; case 1: model = new HistoryViewModel(history[0].RevisionNumber, history[0].RevisionNumber); break; default: model = new HistoryViewModel(history[1].RevisionNumber, history[0].RevisionNumber); break; } return(View(model)); }