public static Config Load(TextReader reader, bool ignoreDuplicates = false)
        {
            var sections = new List<ConfigSection>();
            ConfigSection currentSection = null;
            IDictionary<string, AttributeValue> values = null;
            using (reader)
            {
                var tokenReader = new TokenReader(reader);
                while (tokenReader.ReadNext())
                {
                    if (tokenReader.IsSection())
                    {
                        if (currentSection != null)
                        {
                            sections.Add(currentSection);
                        }

                        currentSection = ConfigSection.FromName(tokenReader.GetValue());
                        values = new Dictionary<string, AttributeValue>();

                    }
                    else if (tokenReader.IsAttribute())
                    {
                        if (currentSection == null)
                            throw new InvalidOperationException("attribute value without section");
                        var attr = AttributeValue.LoadFromString(tokenReader.GetValue());
                        if (!ignoreDuplicates)
                        {
                            if (values.ContainsKey(attr.AttributeName))
                                throw new DuplicateNameException("attributename");
                            values[attr.AttributeName] = attr;
                        }
                        currentSection.AddAttribute(attr);
                    }
                }
                if (currentSection != null)
                    sections.Add(currentSection);

            }
            return new Config(sections);
        }