private static void CreateModules(Target target, IEnumerable<XModule> modules)
        {
            foreach (var module in modules)
            {
                var moduleInTarget = new Module
                {
                    Name = module.Name,
                    Target = target,
                    Namespaces = new List<Namespace>(),
                    Metrics = CreateMetrics(module.Metrics.Metric)
                };

                CreateNamespaces(moduleInTarget, module.Namespaces.Namespace);

                target.Modules.Add(moduleInTarget);
            }
        }
        private static void CreateTargets(Build build, IEnumerable<XTarget> targets)
        {
            foreach (var target in targets)
            {
                var buildTarget = new Target
                {
                    Name = target.Name,
                    Build = build,
                    Modules = new List<Module>()
                };

                CreateModules(buildTarget, target.Modules.Module);

                UpdateTargetMetrics(buildTarget);

                build.Targets.Add(buildTarget);
            }
        }
        private static void UpdateTargetMetrics(Target target)
        {
            var targetMetrics =
                target.Modules
                      .SelectMany(t => t.Metrics)
                      .GroupBy(m => m.Name)
                      .Select(m => new Metric
                      {
                          Name = m.Key,
                          Value = m.Average(v => v.Value)
                      });

            target.Metrics = targetMetrics.ToList();
        }