/// <exclude />
        public override XElement Serialize()
        {
            var element = new XElement(FunctionTreeConfigurationNames.ParamTag,
                                       new XAttribute(FunctionTreeConfigurationNames.NameAttribute, this.Name));

            if (_constantValue is IEnumerable && !(_constantValue is string))
            {
                foreach (object obj in (IEnumerable)_constantValue)
                {
                    element.Add(new XElement(FunctionTreeConfigurationNames.ParamElementTag,
                                             new XAttribute(FunctionTreeConfigurationNames.ValueAttribute,
                                                            XmlSerializationHelper.GetSerializableObject(obj))));
                }

                return(element);
            }

            object xValue;

            if (_constantValue is XNode)
            {
                if (_constantValue is XDocument)
                {
                    xValue = ((XDocument)_constantValue).Root;
                }
                else
                {
                    xValue = _constantValue;
                }
            }
            else
            {
                xValue = new XAttribute(FunctionTreeConfigurationNames.ValueAttributeName,
                                        XmlSerializationHelper.GetSerializableObject(_constantValue) ?? string.Empty);
            }

            element.Add(xValue);

            return(element);
        }