private SearchResult <SomeClass> FilterUsingGrammar(GrammarSearchViewModel model)
 {
     if (model.Grammar == Models.Grammar.Irony)
     {
         return(this.repository
                .GetQuery()
                .FilterUsingIrony(model.SearchTerm, m => m.Text));
     }
     else
     {
         return(this.repository
                .GetQuery()
                .FilterUsingAntlr(model.SearchTerm, m => m.Text));
     }
 }
        public ActionResult Index(GrammarSearchViewModel model)
        {
            try
            {
                var data = this.FilterUsingGrammar(model);
                model.Data  = data;
                model.Terms = data.Terms;
            }
            catch (InvalidSearchException ex)
            {
                ModelState.AddModelError("SearchTerm", ex.Message);

                model.Data  = this.repository.GetQuery();
                model.Terms = Enumerable.Empty <string>();
            }

            return(View(model));
        }