public ActionResult Index(IndexViewModel model) { using (IDocumentSession db = this.OpenSession()) { IQueryable <GearDocument> query = db.Query <GearDocument>(); query = model.AsExpressions().Aggregate(query, (current, expression) => current.Where(expression)); model.Items = query.ToList().Select((x => x.AsItem())).ToList(); } //using (var db = this.docService.OpenSession()) //{ // model.Items = db.LoadGears(model).Select(x => x.AsItem()).ToList(); //} return(View(model)); }