private IEnumerable <TagStatistic> GetChildTagStatistics()
        {
            var queryMainTag =
                from entry in _entries
                from tag in entry.GetTagsAsList()
                group tag by tag.Tag
                into g
                select g;

            var queryChildTags =
                from parentTagGroup in queryMainTag
                from mainTag in parentTagGroup
                from childTag in mainTag.ChildTags
                group childTag by new { ParentTag = mainTag.Tag, ChildTag = childTag.Tag }
            into g
                select new { g.Key.ParentTag, g.Key.ChildTag, Count = g.Count() };

            var queryTagsOnDifferentDates =
                from entry in _entries
                from mainTag in entry.GetTagsAsList()
                from childTag in mainTag.ChildTags
                group mainTag by new { ChildTag = childTag.Tag, ParentTag = mainTag.Tag, entry.Date.Date }
            into g
                select new { g.Key.ParentTag, g.Key.ChildTag, Count = g.Count() };

            var queryTagCount = GetMainTagCount().ToDictionary(key => key.TagName, value => value.Count);

            return(queryChildTags.Select(x =>
                                         TagStatistic.ForChildTag(x.ChildTag, x.ParentTag, x.Count,
                                                                  (decimal)x.Count / queryTagCount[x.ParentTag],
                                                                  (decimal)queryTagsOnDifferentDates.Count(tagByDate =>
                                                                                                           tagByDate.ChildTag == x.ChildTag && tagByDate.ParentTag == x.ParentTag) / TotalDays)));
        }
        private IEnumerable <TagStatistic> GetMainTagStatistics()
        {
            var queryTagCount = GetMainTagCount();

            var queryTagsOnDifferentDates =
                from entry in _entries
                from tag in entry.GetTagsAsList()
                group tag by new { tag.Tag, entry.Date.Date }
            into g
                select new { g.Key.Tag, Count = g.Count() };

            return(queryTagCount.Select(x => TagStatistic.ForMainTag(x.TagName, x.Count,
                                                                     (decimal)x.Count / TotalEntries,
                                                                     (decimal)queryTagsOnDifferentDates.Count(tagByDate => tagByDate.Tag == x.TagName) / TotalDays)));
        }