public void TestAddIndicatorMetadataList()
        {
            IndicatorMetadataCollection collection = new IndicatorMetadataCollection(new List<IndicatorMetadata>());
            Assert.AreEqual(0, collection.IndicatorMetadata.Count);

            // Add metadata
            collection.AddIndicatorMetadata(new List<IndicatorMetadata>{
                new IndicatorMetadata{IndicatorId = 1}
            });

            Assert.AreEqual(1, collection.IndicatorMetadata.Count);
        }
        private IList<IndicatorMetadata> AddTopicData(Area area, IEnumerable<Area> parentAreas)
        {
            IndicatorMetadataCollection allMetadata = new IndicatorMetadataCollection();

            foreach (var groupId in GroupIds)
            {
                IList<Grouping> groupings = groupDataReader.GetGroupingsByGroupId(groupId);

                IList<GroupRoot> roots = new GroupRootBuilder().BuildGroupRoots(groupings);

                IndicatorMetadataCollection metadataCollection =
                    IndicatorMetadataRepository.Instance.GetIndicatorMetadataCollection(groupings);

                allMetadata.AddIndicatorMetadata(metadataCollection.IndicatorMetadata);

                foreach (GroupRoot root in roots)
                {
                    Grouping grouping = root.FirstGrouping;

                    // Add indicator information
                    IndicatorMetadata metadata = metadataCollection.GetIndicatorMetadataById(grouping.IndicatorId);
                    IList<TimePeriod> periods = grouping.GetTimePeriodIterator(metadata.YearType).TimePeriods;
                    writer.AddPracticeIndicatorTitles(metadata, periods);
                    writer.AddCcgIndicatorTitles(metadata, periods);

                    foreach (TimePeriod timePeriod in periods)
                    {
                        // Add data
                        writer.AddPracticeIndicatorData(GetPracticeDataMap(area, grouping, timePeriod));
                        writer.AddAreaIndicatorData(GetParentAreaDataMap(grouping, timePeriod, parentAreas, metadata));
                    }
                }
            }
            return allMetadata.IndicatorMetadata;
        }