private void PersistNewAnalyticStatisticsItem(AnalyticStatisticsItem item)
        {
            AnalyticStatisticsItemEntity entity =
                AnalyticStatisticsItemAssembler.FromDomainObjectToEntity(item);

            using (VTSDatabase database = new VTSDatabase())
            {
                database.AnalyticStatisticsItem.Add(entity);
                database.SaveChanges();
                RememberUpdatedItem(entity);
            }
        }
        private void AggregateAnalyticStatisticsItemEntity(
            AnalyticStatisticsItemEntity item,
            VTSDatabase database)
        {
            VTS.Shared.DomainObjects.AnalyticStatisticsItem asi =
                AnalyticStatisticsItemAssembler.FromEntityToDomainObject(item);
            VTS.AnalysisCore.Common.AnalyticRuleSettings settings = AggregatorFactory.Create(asi).Aggregate();
            AnalyticRuleSettingsEntity entityToUpdate             = database.AnalyticRuleSettings.
                                                                    FirstOrDefault(s => s.RuleType == (int)settings.RuleType && s.EngineType == (int)settings.EngineType);

            if (entityToUpdate == null)
            {
                database.AnalyticRuleSettings.Add(
                    AnalyticRuleSettingsAssembler.FromDomainObjectToEntity(settings));
            }
            else
            {
                AnalyticRuleSettingsEntity sourceEntity =
                    AnalyticRuleSettingsAssembler.FromDomainObjectToEntity(settings);
                UpdateAnalyticRuleStatisticalAtomEntity(sourceEntity, entityToUpdate);
                ReliabilitySummarizer summarizer = new ReliabilitySummarizer();
                summarizer.SummarizeFor(entityToUpdate);
            }
        }