public static void MapTo(this IInstitutionLevelDescriptor source, IInstitutionLevelDescriptor target, Action <IInstitutionLevelDescriptor, IInstitutionLevelDescriptor> onMapped)
        {
            var sourceSynchSupport = source as IInstitutionLevelDescriptorSynchronizationSourceSupport;
            var targetSynchSupport = target as IInstitutionLevelDescriptorSynchronizationSourceSupport;

            // Copy resource Id
            target.Id = source.Id;

            // Copy contextual primary key values
            target.InstitutionLevelDescriptorId = source.InstitutionLevelDescriptorId;

            // Copy inherited non-PK properties

            if (sourceSynchSupport.IsCodeValueSupported)
            {
                target.CodeValue = source.CodeValue;
            }
            else
            {
                targetSynchSupport.IsCodeValueSupported = false;
            }

            if (sourceSynchSupport.IsDescriptionSupported)
            {
                target.Description = source.Description;
            }
            else
            {
                targetSynchSupport.IsDescriptionSupported = false;
            }

            if (sourceSynchSupport.IsEffectiveBeginDateSupported)
            {
                target.EffectiveBeginDate = source.EffectiveBeginDate;
            }
            else
            {
                targetSynchSupport.IsEffectiveBeginDateSupported = false;
            }

            if (sourceSynchSupport.IsEffectiveEndDateSupported)
            {
                target.EffectiveEndDate = source.EffectiveEndDate;
            }
            else
            {
                targetSynchSupport.IsEffectiveEndDateSupported = false;
            }

            if (sourceSynchSupport.IsNamespaceSupported)
            {
                target.Namespace = source.Namespace;
            }
            else
            {
                targetSynchSupport.IsNamespaceSupported = false;
            }

            if (sourceSynchSupport.IsPriorDescriptorIdSupported)
            {
                target.PriorDescriptorId = source.PriorDescriptorId;
            }
            else
            {
                targetSynchSupport.IsPriorDescriptorIdSupported = false;
            }

            if (sourceSynchSupport.IsShortDescriptionSupported)
            {
                target.ShortDescription = source.ShortDescription;
            }
            else
            {
                targetSynchSupport.IsShortDescriptionSupported = false;
            }

            // Copy non-PK properties

            // Copy Aggregate Reference Data


            // ----------------------------------
            //   Map One-to-one relationships
            // ----------------------------------

            // Map inherited lists

            // Map lists


            var eTagProvider = new ETagProvider();

            // Convert value to ETag, if appropriate
            var entityWithETag = target as IHasETag;

            if (entityWithETag != null)
            {
                entityWithETag.ETag = eTagProvider.GetETag(source);
            }

            // Convert value to LastModifiedDate, if appropriate
            var dateVersionedEntity = target as IDateVersionedEntity;
            var etagSource          = source as IHasETag;

            if (dateVersionedEntity != null && etagSource != null)
            {
                dateVersionedEntity.LastModifiedDate = eTagProvider.GetDateTime(etagSource.ETag);
            }
        }
        public static bool SynchronizeTo(this IInstitutionLevelDescriptor source, IInstitutionLevelDescriptor target)
        {
            bool isModified = false;

            var sourceSupport = source as IInstitutionLevelDescriptorSynchronizationSourceSupport;

            // Back synch non-reference portion of PK (PK properties cannot be changed, therefore they can be omitted in the resource payload, but we need them for proper comparisons for persistence)
            if (source.InstitutionLevelDescriptorId != target.InstitutionLevelDescriptorId)
            {
                source.InstitutionLevelDescriptorId = target.InstitutionLevelDescriptorId;
            }

            // Copy inherited non-PK properties


            if ((sourceSupport == null || sourceSupport.IsCodeValueSupported) &&
                target.CodeValue != source.CodeValue)
            {
                target.CodeValue = source.CodeValue;
                isModified       = true;
            }

            if ((sourceSupport == null || sourceSupport.IsDescriptionSupported) &&
                target.Description != source.Description)
            {
                target.Description = source.Description;
                isModified         = true;
            }

            if ((sourceSupport == null || sourceSupport.IsEffectiveBeginDateSupported) &&
                target.EffectiveBeginDate != source.EffectiveBeginDate)
            {
                target.EffectiveBeginDate = source.EffectiveBeginDate;
                isModified = true;
            }

            if ((sourceSupport == null || sourceSupport.IsEffectiveEndDateSupported) &&
                target.EffectiveEndDate != source.EffectiveEndDate)
            {
                target.EffectiveEndDate = source.EffectiveEndDate;
                isModified = true;
            }

            if ((sourceSupport == null || sourceSupport.IsNamespaceSupported) &&
                target.Namespace != source.Namespace)
            {
                target.Namespace = source.Namespace;
                isModified       = true;
            }

            if ((sourceSupport == null || sourceSupport.IsPriorDescriptorIdSupported) &&
                target.PriorDescriptorId != source.PriorDescriptorId)
            {
                target.PriorDescriptorId = source.PriorDescriptorId;
                isModified = true;
            }

            if ((sourceSupport == null || sourceSupport.IsShortDescriptionSupported) &&
                target.ShortDescription != source.ShortDescription)
            {
                target.ShortDescription = source.ShortDescription;
                isModified = true;
            }

            // Copy non-PK properties


            // Synch inherited lists

            // Sync lists

            return(isModified);
        }