public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as ContextComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (Encounter != null)
                    {
                        dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy();
                    }
                    if (Event != null)
                    {
                        dest.Event = new List <Hl7.Fhir.Model.CodeableConcept>(Event.DeepCopy());
                    }
                    if (Period != null)
                    {
                        dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy();
                    }
                    if (FacilityType != null)
                    {
                        dest.FacilityType = (Hl7.Fhir.Model.CodeableConcept)FacilityType.DeepCopy();
                    }
                    if (PracticeSetting != null)
                    {
                        dest.PracticeSetting = (Hl7.Fhir.Model.CodeableConcept)PracticeSetting.DeepCopy();
                    }
                    if (SourcePatientInfo != null)
                    {
                        dest.SourcePatientInfo = (Hl7.Fhir.Model.ResourceReference)SourcePatientInfo.DeepCopy();
                    }
                    if (Related != null)
                    {
                        dest.Related = new List <Hl7.Fhir.Model.DocumentReference.RelatedComponent>(Related.DeepCopy());
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }