public IDictionary <int, RootEntityMicroSummary> Execute(GetCustomEntityVersionPageModuleEntityMicroSummariesByIdRangeQuery query, IExecutionContext executionContext)
        {
            var results = Query(query).ToDictionary(e => e.ChildEntityId, e => (RootEntityMicroSummary)e);

            EnforcePermissions(results, executionContext);

            return(results);
        }
        private IQueryable <ChildEntityMicroSummary> Query(GetCustomEntityVersionPageModuleEntityMicroSummariesByIdRangeQuery query)
        {
            var dbQuery = _dbContext
                          .CustomEntityVersionPageModules
                          .AsNoTracking()
                          .Where(m => query.CustomEntityVersionPageModuleIds.Contains(m.CustomEntityVersionPageModuleId))
                          .Select(m => new ChildEntityMicroSummary()
            {
                ChildEntityId        = m.CustomEntityVersionPageModuleId,
                RootEntityId         = m.CustomEntityVersion.CustomEntityId,
                RootEntityTitle      = m.CustomEntityVersion.Title,
                EntityDefinitionCode = m.CustomEntityVersion.CustomEntity.CustomEntityDefinition.EntityDefinition.EntityDefinitionCode,
                EntityDefinitionName = m.CustomEntityVersion.CustomEntity.CustomEntityDefinition.EntityDefinition.Name,
                IsPreviousVersion    = m.CustomEntityVersion.WorkFlowStatusId != (int)WorkFlowStatus.Published || m.CustomEntityVersion.WorkFlowStatusId != (int)WorkFlowStatus.Draft
            });

            return(dbQuery);
        }