public IEnumerable <WorkflowInstanceInfo> GetInstances(WorkflowStatus?filter = null) { if (null == filter) { var queryResult = _instanceData.All(); return(queryResult.Items.EmptyIfNull()); } else { var qs = new QuerySpecification { BookMark = new GenericPageBookmark { PageSize = 1000 }, Where = new Filter { PredicateJoin = PredicateJoin.And, Rules = new Comparison[] { new Comparison { Data = filter.Value.EnumName(), Field = "Status", Test = Test.Equal } } } }; var queryResult = _instanceData.Query(qs); return(queryResult.Items.EmptyIfNull()); } }