/// <summary>
 /// The update representation reference.
 /// </summary>
 /// <param name="representation">
 /// The representation.
 /// </param>
 /// <param name="updateReferences">
 /// The update references.
 /// </param>
 protected void UpdateRepresentationReference(IRepresentationMutableObject representation, IDictionary<IStructureReference, IStructureReference> updateReferences)
 {
     if (representation != null && representation.Representation != null)
     {
         IStructureReference mapTo = updateReferences[representation.Representation];
         if (mapTo != null)
         {
             representation.Representation = mapTo;
         }
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ComponentMutableCore"/> class.
        /// </summary>
        /// <param name="objTarget">
        /// The obj target. 
        /// </param>
        public ComponentMutableCore(IComponent objTarget)
            : base(objTarget)
        {
            if (objTarget.Representation != null)
            {
                this.representation = new RepresentationMutableCore(objTarget.Representation);
            }

            if (objTarget.ConceptRef != null)
            {
                this.conceptRef = objTarget.ConceptRef.CreateMutableInstance();
            }
        }
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////BUILD FROM MUTABLE OBJECT                 //////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="RepresentationCore"/> class.
        /// </summary>
        /// <param name="representationMutableObject">
        /// The sdmxObject. 
        /// </param>
        /// <param name="parent">
        /// The parent. 
        /// </param>
        public RepresentationCore(IRepresentationMutableObject representationMutableObject, IIdentifiableObject parent)
            : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.LocalRepresentation), parent)
        {
            if (representationMutableObject.TextFormat != null)
            {
                this.textFormat = new TextFormatObjectCore(representationMutableObject.TextFormat, this);
            }

            if (representationMutableObject.Representation != null)
            {
                this.representation = new CrossReferenceImpl(this, representationMutableObject.Representation);
            }

            this.Validate();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConceptMutableCore"/> class.
        /// </summary>
        /// <param name="objTarget">
        /// The agencySchemeMutable target. 
        /// </param>
        public ConceptMutableCore(IConceptObject objTarget)
            : base(objTarget)
        {
            if (objTarget.CoreRepresentation != null)
            {
                this._coreRepresentation = new RepresentationMutableCore(objTarget.CoreRepresentation);
            }

            if (objTarget.IsoConceptReference != null)
            {
                this._isoConceptReference = objTarget.IsoConceptReference.CreateMutableInstance();
            }

            this._parent = objTarget.ParentConcept;
            this._parentAgency = objTarget.ParentAgency;
        }
        /// <summary>
        /// Write the representation xml attribute of a Component
        /// </summary>
        /// <param name="representation">
        /// The representation object
        /// </param>
        private void WriteRepresentation(IRepresentationMutableObject representation)
        {
            if (representation != null && representation.Representation != null)
            {
                IMaintainableRefObject codelist = representation.Representation.MaintainableReference;

                this.TryWriteAttribute(AttributeNameTable.codelist, codelist.MaintainableId);
                this.TryWriteAttribute(AttributeNameTable.codelistVersion, codelist.Version);
                this.TryWriteAttribute(AttributeNameTable.codelistAgency, codelist.AgencyId);
            }
        }