public ActionResult Index() { object result; HistoryModelList modelList = new HistoryModelList(); var model = new HistoryModel(); var dataSource = Sitecore.Context.Item; if (dataSource.TemplateID == Templates.Page.ID) { var hackathonItems = dataSource.GetChildren().ToList().Find(x => x.TemplateID.ToString() == Templates.Hackathon.Folder.ToString()).GetChildren(); foreach (Item item in hackathonItems) { if (item != null) { var itemData = item.Fields[Templates.Hackathon.Fields.HackathonData].Value; var data = Sitecore.Context.Database?.GetItem(itemData); model.SetData(data); modelList.ListHistoryMode.Add(model); } } } else { result = dataSource; } return(View("History", model)); }