/// <summary>
        /// Add the given Dataset to the Information Model. The data is normalised into the Information Model.
        /// </summary>
        /// <param name="dataset">Dataset to add to Informatio Model.</param>
        /// <param name="storeDataset">Boolean indicating whether or not the dataset should also be stored to file for possible retrieval.</param>
        public void AddToInformationModel(DataSet dataset, bool storeDataset)
        {
            // PATIENT level
            PatientInformationEntity patientInformationEntity = null;

            // check if the patient IE is already in the patientRootList
            foreach (PatientInformationEntity lPatientInformationEntity in Root)
            {
                if (lPatientInformationEntity.IsFoundIn(dataset))
                {
                    patientInformationEntity = lPatientInformationEntity;
                    break;
                }
            }

            // patient IE is not already in the patientRootList
            if (patientInformationEntity == null)
            {
                // create a new patient IE from the dataset and add to the patientRootList
                patientInformationEntity = new PatientInformationEntity();
                patientInformationEntity.CopyFrom(dataset);
                //Root.Add(patientInformationEntity);

                // Modified by RB 20090128 - when handling an order scheduled event from an actor
                // we want to insert the order as the first entry in the information model so that
                // it is returned as the first entry in the worklist query
                Root.Insert(0, patientInformationEntity);
            }

            // VISIT level
            VisitInformationEntity visitInformationEntity = null;

            // check if the visit IE is already in the patient IE children
            foreach (VisitInformationEntity lVisitInformationEntity in patientInformationEntity.Children)
            {
                if (lVisitInformationEntity.IsFoundIn(dataset))
                {
                    visitInformationEntity = lVisitInformationEntity;
                    break;
                }
            }

            // visit IE is not already in the patient IE children
            if (visitInformationEntity == null)
            {
                // create a new visit IE from the dataset and add to the patient IE children
                visitInformationEntity = new VisitInformationEntity();
                visitInformationEntity.CopyFrom(dataset);
                patientInformationEntity.AddChild(visitInformationEntity);
            }

            // IMAGING SERVICE REQUEST level
            ImagingServiceRequestInformationEntity imagingServiceRequestInformationEntity = null;

            // check if the imaging service request IE is already in the visit IE children
            foreach (ImagingServiceRequestInformationEntity lImagingServiceRequestInformationEntity in visitInformationEntity.Children)
            {
                if (lImagingServiceRequestInformationEntity.IsFoundIn(dataset))
                {
                    imagingServiceRequestInformationEntity = lImagingServiceRequestInformationEntity;
                    break;
                }
            }

            // imaging service request IE is not already in the visit IE children
            if (imagingServiceRequestInformationEntity == null)
            {
                // create a new imaging service request IE from the dataset and add to the visit IE children
                imagingServiceRequestInformationEntity = new ImagingServiceRequestInformationEntity();
                imagingServiceRequestInformationEntity.CopyFrom(dataset);
                visitInformationEntity.AddChild(imagingServiceRequestInformationEntity);
            }

            // REQUESTED PROCEDURE level
            RequestedProcedureInformationEntity requestedProcedureInformationEntity = null;

            // check if the requested procedure IE is already in the imaging service request IE children
            foreach (RequestedProcedureInformationEntity lRequestedProcedureInformationEntity in imagingServiceRequestInformationEntity.Children)
            {
                if (lRequestedProcedureInformationEntity.IsFoundIn(dataset))
                {
                    requestedProcedureInformationEntity = lRequestedProcedureInformationEntity;
                    break;
                }
            }

            // requested procedure IE is not already in the imaging service request IE children
            if (requestedProcedureInformationEntity == null)
            {
                // create a new requested procedure IE from the dataset and add to the imaging service request IE children
                requestedProcedureInformationEntity = new RequestedProcedureInformationEntity();
                requestedProcedureInformationEntity.CopyFrom(dataset);
                imagingServiceRequestInformationEntity.AddChild(requestedProcedureInformationEntity);
            }

            // SCHEDULED PROCEDURE STEP level
            ScheduledProcedureStepInformationEntity scheduledProcedureStepInformationEntity = null;

            // check if the scheduled procedure step IE is already in the requested procedure IE children
            foreach (ScheduledProcedureStepInformationEntity lScheduledProcedureStepInformationEntity in requestedProcedureInformationEntity.Children)
            {
                if (lScheduledProcedureStepInformationEntity.IsFoundIn(dataset))
                {
                    scheduledProcedureStepInformationEntity = lScheduledProcedureStepInformationEntity;
                    break;
                }
            }

            // scheduled procedure step IE is not already in the requested procedure IE children
            if (scheduledProcedureStepInformationEntity == null)
            {
                // create a new scheduled procedure step IE from the dataset and add to the requested procedure IE children
                scheduledProcedureStepInformationEntity = new ScheduledProcedureStepInformationEntity();
                scheduledProcedureStepInformationEntity.CopyFrom(dataset);
                requestedProcedureInformationEntity.AddChild(scheduledProcedureStepInformationEntity);
            }
        }
        /// <summary>
        /// Add the given Dataset to the Information Model. The data is normalised into the Information Model.
        /// </summary>
        /// <param name="dataset">Dataset to add to Informatio Model.</param>
        public override void AddToInformationModel(DataSet dataset)
        {
            // PATIENT level
            PatientInformationEntity patientInformationEntity = null;

            // check if the patient IE is already in the patientRootList
            foreach (PatientInformationEntity lPatientInformationEntity in Root)
            {
                if (lPatientInformationEntity.IsFoundIn(dataset))
                {
                    patientInformationEntity = lPatientInformationEntity;
                    break;
                }
            }

            // patient IE is not already in the patientRootList
            if (patientInformationEntity == null)
            {
                // create a new patient IE from the dataset and add to the patientRootList
                patientInformationEntity = new PatientInformationEntity();
                patientInformationEntity.CopyFrom(dataset);
                Root.Add(patientInformationEntity);
            }

            // VISIT level
            VisitInformationEntity visitInformationEntity = null;

            // check if the visit IE is already in the patient IE children
            foreach (VisitInformationEntity lVisitInformationEntity in patientInformationEntity.Children)
            {
                if (lVisitInformationEntity.IsFoundIn(dataset))
                {
                    visitInformationEntity = lVisitInformationEntity;
                    break;
                }
            }

            // visit IE is not already in the patient IE children
            if (visitInformationEntity == null)
            {
                // create a new visit IE from the dataset and add to the patient IE children
                visitInformationEntity = new VisitInformationEntity();
                visitInformationEntity.CopyFrom(dataset);
                patientInformationEntity.AddChild(visitInformationEntity);
            }

            // IMAGING SERVICE REQUEST level
            ImagingServiceRequestInformationEntity imagingServiceRequestInformationEntity = null;

            // check if the imaging service request IE is already in the visit IE children
            foreach (ImagingServiceRequestInformationEntity lImagingServiceRequestInformationEntity in visitInformationEntity.Children)
            {
                if (lImagingServiceRequestInformationEntity.IsFoundIn(dataset))
                {
                    imagingServiceRequestInformationEntity = lImagingServiceRequestInformationEntity;
                    break;
                }
            }

            // imaging service request IE is not already in the visit IE children
            if (imagingServiceRequestInformationEntity == null)
            {
                // create a new imaging service request IE from the dataset and add to the visit IE children
                imagingServiceRequestInformationEntity = new ImagingServiceRequestInformationEntity();
                imagingServiceRequestInformationEntity.CopyFrom(dataset);
                visitInformationEntity.AddChild(imagingServiceRequestInformationEntity);
            }

            // REQUESTED PROCEDURE level
            RequestedProcedureInformationEntity requestedProcedureInformationEntity = null;

            // check if the requested procedure IE is already in the imaging service request IE children
            foreach (RequestedProcedureInformationEntity lRequestedProcedureInformationEntity in imagingServiceRequestInformationEntity.Children)
            {
                if (lRequestedProcedureInformationEntity.IsFoundIn(dataset))
                {
                    requestedProcedureInformationEntity = lRequestedProcedureInformationEntity;
                    break;
                }
            }

            // requested procedure IE is not already in the imaging service request IE children
            if (requestedProcedureInformationEntity == null)
            {
                // create a new requested procedure IE from the dataset and add to the imaging service request IE children
                requestedProcedureInformationEntity = new RequestedProcedureInformationEntity();
                requestedProcedureInformationEntity.CopyFrom(dataset);
                imagingServiceRequestInformationEntity.AddChild(requestedProcedureInformationEntity);
            }

            // SCHEDULED PROCEDURE STEP level
            ScheduledProcedureStepInformationEntity scheduledProcedureStepInformationEntity = null;

            // check if the scheduled procedure step IE is already in the requested procedure IE children
            foreach (ScheduledProcedureStepInformationEntity lScheduledProcedureStepInformationEntity in requestedProcedureInformationEntity.Children)
            {
                if (lScheduledProcedureStepInformationEntity.IsFoundIn(dataset))
                {
                    scheduledProcedureStepInformationEntity = lScheduledProcedureStepInformationEntity;
                    break;
                }
            }

            // scheduled procedure step IE is not already in the requested procedure IE children
            if (scheduledProcedureStepInformationEntity == null)
            {
                // create a new scheduled procedure step IE from the dataset and add to the requested procedure IE children
                scheduledProcedureStepInformationEntity = new ScheduledProcedureStepInformationEntity();
                scheduledProcedureStepInformationEntity.CopyFrom(dataset);
                requestedProcedureInformationEntity.AddChild(scheduledProcedureStepInformationEntity);
            }
        }
        /// <summary>
        /// Add the given Dataset to the Information Model. The data is normalised into the Information Model.
        /// </summary>
        /// <param name="dataset">Dataset to add to Informatio Model.</param>
        public override void AddToInformationModel(DataSet dataset)
        {
            // PATIENT level
            PatientInformationEntity patientInformationEntity = null;

            // check if the patient IE is already in the patientRootList
            foreach (PatientInformationEntity lPatientInformationEntity in Root)
            {
                if (lPatientInformationEntity.IsFoundIn(dataset))
                {
                    patientInformationEntity = lPatientInformationEntity;
                    break;
                }
            }

            // patient IE is not already in the patientRootList
            if (patientInformationEntity == null)
            {
                // create a new patient IE from the dataset and add to the patientRootList
                patientInformationEntity = new PatientInformationEntity();
                patientInformationEntity.CopyFrom(dataset);
                Root.Add(patientInformationEntity);
            }

            // VISIT level
            VisitInformationEntity visitInformationEntity = null;

            // check if the visit IE is already in the patient IE children
            foreach (VisitInformationEntity lVisitInformationEntity in patientInformationEntity.Children)
            {
                if (lVisitInformationEntity.IsFoundIn(dataset))
                {
                    visitInformationEntity = lVisitInformationEntity;
                    break;
                }
            }

            // visit IE is not already in the patient IE children
            if (visitInformationEntity == null)
            {
                // create a new visit IE from the dataset and add to the patient IE children
                visitInformationEntity = new VisitInformationEntity();
                visitInformationEntity.CopyFrom(dataset);
                patientInformationEntity.AddChild(visitInformationEntity);
            }

            // IMAGING SERVICE REQUEST level
            ImagingServiceRequestInformationEntity imagingServiceRequestInformationEntity = null;

            // check if the imaging service request IE is already in the visit IE children
            foreach (ImagingServiceRequestInformationEntity lImagingServiceRequestInformationEntity in visitInformationEntity.Children)
            {
                if (lImagingServiceRequestInformationEntity.IsFoundIn(dataset))
                {
                    imagingServiceRequestInformationEntity = lImagingServiceRequestInformationEntity;
                    break;
                }
            }

            // imaging service request IE is not already in the visit IE children
            if (imagingServiceRequestInformationEntity == null)
            {
                // create a new imaging service request IE from the dataset and add to the visit IE children
                imagingServiceRequestInformationEntity = new ImagingServiceRequestInformationEntity();
                imagingServiceRequestInformationEntity.CopyFrom(dataset);
                visitInformationEntity.AddChild(imagingServiceRequestInformationEntity);
            }

            // REQUESTED PROCEDURE level
            RequestedProcedureInformationEntity requestedProcedureInformationEntity = null;

            // check if the requested procedure IE is already in the imaging service request IE children
            foreach (RequestedProcedureInformationEntity lRequestedProcedureInformationEntity in imagingServiceRequestInformationEntity.Children)
            {
                if (lRequestedProcedureInformationEntity.IsFoundIn(dataset))
                {
                    requestedProcedureInformationEntity = lRequestedProcedureInformationEntity;
                    break;
                }
            }

            // requested procedure IE is not already in the imaging service request IE children
            if (requestedProcedureInformationEntity == null)
            {
                // create a new requested procedure IE from the dataset and add to the imaging service request IE children
                requestedProcedureInformationEntity = new RequestedProcedureInformationEntity();
                requestedProcedureInformationEntity.CopyFrom(dataset);
                imagingServiceRequestInformationEntity.AddChild(requestedProcedureInformationEntity);
            }

            // SCHEDULED PROCEDURE STEP level
            ScheduledProcedureStepInformationEntity scheduledProcedureStepInformationEntity = null;

            // check if the scheduled procedure step IE is already in the requested procedure IE children
            foreach (ScheduledProcedureStepInformationEntity lScheduledProcedureStepInformationEntity in requestedProcedureInformationEntity.Children)
            {
                if (lScheduledProcedureStepInformationEntity.IsFoundIn(dataset))
                {
                    scheduledProcedureStepInformationEntity = lScheduledProcedureStepInformationEntity;
                    break;
                }
            }

            // scheduled procedure step IE is not already in the requested procedure IE children
            if (scheduledProcedureStepInformationEntity == null)
            {
                // create a new scheduled procedure step IE from the dataset and add to the requested procedure IE children
                scheduledProcedureStepInformationEntity = new ScheduledProcedureStepInformationEntity();
                scheduledProcedureStepInformationEntity.CopyFrom(dataset);
                requestedProcedureInformationEntity.AddChild(scheduledProcedureStepInformationEntity);
            }
        }
        /// <summary>
        /// Add the given Dataset to the Information Model. The data is normalised into the Information Model.
        /// </summary>
        /// <param name="dataset">Dataset to add to Informatio Model.</param>
        /// <param name="storeDataset">Boolean indicating whether or not the dataset should also be stored to file for possible retrieval.</param>
        public void AddToInformationModel(DataSet dataset, bool storeDataset)
        {
            // PATIENT level
            PatientInformationEntity patientInformationEntity = null;

            // check if the patient IE is already in the patientRootList
            foreach (PatientInformationEntity lPatientInformationEntity in Root)
            {
                if (lPatientInformationEntity.IsFoundIn(dataset))
                {
                    patientInformationEntity = lPatientInformationEntity;
                    break;
                }
            }

            // patient IE is not already in the patientRootList
            if (patientInformationEntity == null)
            {
                // create a new patient IE from the dataset and add to the patientRootList
                patientInformationEntity = new PatientInformationEntity();
                patientInformationEntity.CopyFrom(dataset);
                //Root.Add(patientInformationEntity);

                // Modified by RB 20090128 - when handling an order scheduled event from an actor
                // we want to insert the order as the first entry in the information model so that
                // it is returned as the first entry in the worklist query
                Root.Insert(0, patientInformationEntity);
            }

            // VISIT level
            VisitInformationEntity visitInformationEntity = null;

            // check if the visit IE is already in the patient IE children
            foreach (VisitInformationEntity lVisitInformationEntity in patientInformationEntity.Children)
            {
                if (lVisitInformationEntity.IsFoundIn(dataset))
                {
                    visitInformationEntity = lVisitInformationEntity;
                    break;
                }
            }

            // visit IE is not already in the patient IE children
            if (visitInformationEntity == null)
            {
                // create a new visit IE from the dataset and add to the patient IE children
                visitInformationEntity = new VisitInformationEntity();
                visitInformationEntity.CopyFrom(dataset);
                patientInformationEntity.AddChild(visitInformationEntity);
            }

            // IMAGING SERVICE REQUEST level
            ImagingServiceRequestInformationEntity imagingServiceRequestInformationEntity = null;

            // check if the imaging service request IE is already in the visit IE children
            foreach (ImagingServiceRequestInformationEntity lImagingServiceRequestInformationEntity in visitInformationEntity.Children)
            {
                if (lImagingServiceRequestInformationEntity.IsFoundIn(dataset))
                {
                    imagingServiceRequestInformationEntity = lImagingServiceRequestInformationEntity;
                    break;
                }
            }

            // imaging service request IE is not already in the visit IE children
            if (imagingServiceRequestInformationEntity == null)
            {
                // create a new imaging service request IE from the dataset and add to the visit IE children
                imagingServiceRequestInformationEntity = new ImagingServiceRequestInformationEntity();
                imagingServiceRequestInformationEntity.CopyFrom(dataset);
                visitInformationEntity.AddChild(imagingServiceRequestInformationEntity);
            }

            // REQUESTED PROCEDURE level
            RequestedProcedureInformationEntity requestedProcedureInformationEntity = null;

            // check if the requested procedure IE is already in the imaging service request IE children
            foreach (RequestedProcedureInformationEntity lRequestedProcedureInformationEntity in imagingServiceRequestInformationEntity.Children)
            {
                if (lRequestedProcedureInformationEntity.IsFoundIn(dataset))
                {
                    requestedProcedureInformationEntity = lRequestedProcedureInformationEntity;
                    break;
                }
            }

            // requested procedure IE is not already in the imaging service request IE children
            if (requestedProcedureInformationEntity == null)
            {
                // create a new requested procedure IE from the dataset and add to the imaging service request IE children
                requestedProcedureInformationEntity = new RequestedProcedureInformationEntity();
                requestedProcedureInformationEntity.CopyFrom(dataset);
                imagingServiceRequestInformationEntity.AddChild(requestedProcedureInformationEntity);
            }

            // SCHEDULED PROCEDURE STEP level
            ScheduledProcedureStepInformationEntity scheduledProcedureStepInformationEntity = null;

            // check if the scheduled procedure step IE is already in the requested procedure IE children
            foreach (ScheduledProcedureStepInformationEntity lScheduledProcedureStepInformationEntity in requestedProcedureInformationEntity.Children)
            {
                if (lScheduledProcedureStepInformationEntity.IsFoundIn(dataset))
                {
                    scheduledProcedureStepInformationEntity = lScheduledProcedureStepInformationEntity;
                    break;
                }
            }

            // scheduled procedure step IE is not already in the requested procedure IE children
            if (scheduledProcedureStepInformationEntity == null)
            {
                // create a new scheduled procedure step IE from the dataset and add to the requested procedure IE children
                scheduledProcedureStepInformationEntity = new ScheduledProcedureStepInformationEntity();
                scheduledProcedureStepInformationEntity.CopyFrom(dataset);
                requestedProcedureInformationEntity.AddChild(scheduledProcedureStepInformationEntity);
            }
        }