private ICodeSystemCode QueryCodeSystemCode(Guid codeGuid)
        {
            var factory = new CodeSystemCodeFactory(this.codeSystems.Value);
            var dto     = this.GetBaseQuery(true).SingleOrDefault(d => d.CodeGUID == codeGuid);

            return(dto != null?factory.Build(dto) : null);
        }
        private async Task <PagedCollection <ICodeSystemCode> > CreatePagedCollectionAsync(
            IQueryable <CodeSystemCodeDto> source,
            IPagerSettings pagerSettings)
        {
            var defaultItemsPerPage = this.sharedContext.Settings.DefaultItemsPerPage;
            var pagingStrategy      = this.pagingStrategyFactory.GetPagingStrategy <ICodeSystemCode>(defaultItemsPerPage);

            pagingStrategy.EnsurePagerSettings(pagerSettings);

            var count = await source.CountAsync().ConfigureAwait(false);

            var items = await source.OrderBy(dto => dto.CodeDSC)
                        .Skip((pagerSettings.CurrentPage - 1) * pagerSettings.ItemsPerPage)
                        .Take(pagerSettings.ItemsPerPage)
                        .ToListAsync().ConfigureAwait(false);

            var factory = new CodeSystemCodeFactory(this.codeSystems.Value);

            return(pagingStrategy.CreatePagedCollection(
                       items.Select(i => this.codeSystemCodeCachingManager.GetOrSet(i.CodeGUID, () => factory.Build(i))
                                    ).Values(),
                       count,
                       pagerSettings));
        }