public ActionResult Index()
        {
            List <Competition> competitions = null;

            //always put CompetitionRepository inside a using block, so Dispose is called and database connection is closed.
            //failure to do that could cause serious memory leak.
            using (CompetitionRepository repository = new CompetitionRepository())
            {
                competitions = repository.GetCompetitionsCreatedByUser(UserID);
            }

            //if another method redirected to here show the purr message
            if (TempData[ControllerHelpers.PURR] != null)
            {
                ViewBag.Purr = TempData[ControllerHelpers.PURR];
                TempData[ControllerHelpers.PURR] = null;
            }

            //if the view name is the same as the name of this method (eg Index), then there is no need to
            //pass name of view to View() constructor.
            return(View(competitions));
        }