private void WriteExtract(TrackingExtract extract, XmlTextWriter writer)
        {
            Type t = extract.GetType();

            if ((extract is ActivityDataTrackingExtract) || (extract is WorkflowDataTrackingExtract))
            {
                writer.WriteStartElement(extract.GetType().Name);
                writer.WriteElementString("Member", (null == extract.Member ? string.Empty : extract.Member));

                WriteAnnotations(extract.Annotations, writer);

                writer.WriteEndElement();
            }
            else
                throw new ArgumentException(ExecutionStringManager.TrackingSerializationInvalidExtract);
        }
        private void CreateExtract(XmlReader reader, TrackingExtract extract)
        {
            if (null == reader)
                throw new ArgumentNullException("reader");

            if (null == extract)
                throw new ArgumentNullException("extract");

            if (reader.IsEmptyElement)
                return;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (0 == string.Compare(reader.Name, "Member", StringComparison.Ordinal))
                            extract.Member = reader.ReadString();
                        else if (0 == string.Compare(reader.Name, "Annotations", StringComparison.Ordinal))
                            CreateAnnotations(reader, extract.Annotations);
                        //
                        // Xsd validation will catch unknown elements

                        break;
                    case XmlNodeType.EndElement:
                        if (0 == string.Compare(reader.Name, extract.GetType().Name, StringComparison.Ordinal))
                            return;
                        break;
                }
            }
            //
            // Only valid exit is on an EndElement that matches the element that is passed in.
            throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationCloseElementNotFound + extract.GetType().Name);
        }
        private void CreateExtract(XmlReader reader, TrackingExtract extract)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (extract == null)
            {
                throw new ArgumentNullException("extract");
            }
            if (!reader.IsEmptyElement)
            {
                while (true)
                {
                    if (!reader.Read())
                    {
                        throw new TrackingProfileDeserializationException(ExecutionStringManager.TrackingDeserializationCloseElementNotFound + extract.GetType().Name);
                    }
                    switch (reader.NodeType)
                    {
                        case XmlNodeType.Element:
                            if (string.Compare(reader.Name, "Member", StringComparison.Ordinal) == 0)
                            {
                                extract.Member = reader.ReadString();
                            }
                            else if (string.Compare(reader.Name, "Annotations", StringComparison.Ordinal) == 0)
                            {
                                this.CreateAnnotations(reader, extract.Annotations);
                            }
                            break;

                        case XmlNodeType.EndElement:
                            if (string.Compare(reader.Name, extract.GetType().Name, StringComparison.Ordinal) == 0)
                            {
                                return;
                            }
                            break;
                    }
                }
            }
        }