public virtual ActionResult PreviousIdea(string id) { if (IdeasList == null || IdeasList.Count == 0) { return(RedirectToAction(MVC.Voting.Details(id, null))); } var current = IdeasList.SingleOrDefault(i => i.Id == id); var index = IdeasList.IndexOf(current) - 1; if (index < 0) { index = IdeasList.Count - 1; } return(RedirectToAction(MVC.Idea.Details(IdeasList[index].Id, IdeasList[index].Subject.ToSeoUrl(), null))); }