/// <summary>
        /// Helper method that implements the logic for performing searches on worklists.
        /// </summary>
        /// <typeparam name="TItem"></typeparam>
        /// <typeparam name="TSummary"></typeparam>
        /// <param name="request"></param>
        /// <param name="broker"></param>
        /// <param name="projection"></param>
        /// <param name="mapCallback"></param>
        /// <returns></returns>
        protected TextQueryResponse <TSummary> SearchHelper <TItem, TSummary>(
            WorklistItemTextQueryRequest request,
            IWorklistItemBroker broker,
            WorklistItemProjection projection,
            Converter <TItem, TSummary> mapCallback)
            where TSummary : DataContractBase
            where TItem : WorklistItem
        {
            var procedureStepClass = request.ProcedureStepClassName == null ? null
                                : ProcedureStep.GetSubClass(request.ProcedureStepClassName, PersistenceContext);

            var helper = new WorklistItemTextQueryHelper <TItem, TSummary>(broker, mapCallback, procedureStepClass, projection, request.Options, PersistenceContext);

            return(helper.Query(request));
        }
        public TextQueryResponse <ReportingWorklistItemSummary> SearchWorklists(WorklistItemTextQueryRequest request)
        {
            var procedureStepClass = request.ProcedureStepClassName == null ? null
                                : ProcedureStep.GetSubClass(request.ProcedureStepClassName, PersistenceContext);

            // decide which broker/projection to use for searching
            var isReporting = typeof(ReportingProcedureStep).IsAssignableFrom(procedureStepClass);
            var broker      = isReporting ?
                              (IWorklistItemBroker)PersistenceContext.GetBroker <IReportingWorklistItemBroker>()
                                : PersistenceContext.GetBroker <IProtocolWorklistItemBroker>();

            var projection = isReporting ?
                             WorklistItemProjection.ReportingWorklistSearch :
                             WorklistItemProjection.ProtocolWorklistSearch;


            var assembler = new ReportingWorkflowAssembler();

            return(SearchHelper <ReportingWorklistItem, ReportingWorklistItemSummary>(
                       request,
                       broker,
                       projection,
                       item => assembler.CreateWorklistItemSummary(item, PersistenceContext)));
        }