/// <summary>
        /// Fired when the MDM Subscription has been executed
        /// </summary>
        private void MdmSubscriptionExecuted(object sender, Core.Event.QueryResultEventArgs <Core.Model.IdentifiedData> e)
        {
            var authPrincipal = AuthenticationContext.Current.Principal;

            // Results contain LOCAL records most likely
            // We have a resource type that matches
            e.Results = e.Results.Select((res) =>
            {
                if (!this.m_configuration.ResourceTypes.Any(o => o.Type == res.GetType()))
                {
                    return(res);
                }
                // Result is taggable and a tag exists for MDM
                if (res is Entity entity)
                {
                    if (entity.ClassConceptKey != MdmConstants.MasterRecordClassification)
                    {
                        // just a regular record
                        // Attempt to load the master and add to the results
                        var master = entity.LoadCollection <EntityRelationship>(nameof(Entity.Relationships)).FirstOrDefault(o => o.RelationshipTypeKey == MdmConstants.MasterRecordRelationship);
                        if (master == null) // load from DB
                        {
                            master = EntitySource.Current.Provider.Query <EntityRelationship>(o => o.SourceEntityKey == entity.Key && o.RelationshipTypeKey == MdmConstants.MasterRecordRelationship).FirstOrDefault();
                        }

                        var masterType = typeof(EntityMaster <>).MakeGenericType(res.GetType());

                        if (master != null)
                        {
                            return((Activator.CreateInstance(masterType, master.LoadProperty <Entity>(nameof(EntityRelationship.TargetEntity))) as IMdmMaster).Synthesize(authPrincipal));
                        }
                        else
                        {
                            entity.Tags.Add(new Core.Model.DataTypes.EntityTag("$mdm.type", "O")); // Orphan record
                            return(entity);
                        }
                    }
                    else // is a master
                    {
                        var masterType = typeof(EntityMaster <>).MakeGenericType(MapUtil.GetModelTypeFromClassKey(entity.ClassConceptKey.Value));
                        return((Activator.CreateInstance(masterType, entity) as IMdmMaster).Synthesize(authPrincipal));
                    }
                }
                else if (res is Act act && act.ClassConceptKey != MdmConstants.MasterRecordClassification)
                {
                    // Attempt to load the master and add to the results
                    var master = act.LoadCollection <ActRelationship>(nameof(Act.Relationships)).FirstOrDefault(o => o.RelationshipTypeKey == MdmConstants.MasterRecordRelationship);
                    if (master == null) // load from DB
                    {
                        master = EntitySource.Current.Provider.Query <ActRelationship>(o => o.SourceEntityKey == act.Key && o.RelationshipTypeKey == MdmConstants.MasterRecordRelationship).FirstOrDefault();
                    }
                    var masterType = typeof(EntityMaster <>).MakeGenericType(res.GetType());
                    return((Activator.CreateInstance(masterType, master.LoadProperty <Act>(nameof(ActRelationship.TargetAct))) as IMdmMaster).Synthesize(authPrincipal));
                }