// Called at deployment time
        public void Initialize()
        {
            var sw = Stopwatch.StartNew();

            var keepSyncRepos  = _genericRepositories.GetGenericRepository <IKeepSynchronizedMetadata>();
            var oldItems       = keepSyncRepos.Load();
            var avoidRecompute = new HashSet <string>(oldItems.Where(item => item.Context == "NORECOMPUTE").Select(GetKey));

            IEnumerable <IKeepSynchronizedMetadata> toInsert, toUpdate, toDelete;

            keepSyncRepos.Diff(oldItems, _currentKeepSynchronizedMetadata, new SameRecord(), SameValue, Assign, out toInsert, out toUpdate, out toDelete);

            foreach (var keepSynchronized in toInsert.Concat(toUpdate))
            {
                if (!avoidRecompute.Contains(GetKey(keepSynchronized)))
                {
                    _logger.Info(() => string.Format("Recomputing {0} from {1}.", keepSynchronized.Target, keepSynchronized.Source));
                    _genericRepositories.GetGenericRepository(keepSynchronized.Target).RecomputeFrom(keepSynchronized.Source);
                    _performanceLogger.Write(sw, () => string.Format("KeepSynchronizedRecomputeOnDeploy: {0} from {1}.", keepSynchronized.Target, keepSynchronized.Source));
                }
                else
                {
                    _logger.Info(() => string.Format("Specified not to recompute {0} from {1}.", keepSynchronized.Target, keepSynchronized.Source));
                }
            }

            keepSyncRepos.Save(toInsert, toUpdate, toDelete);
        }
        // Called at deployment time
        public void Initialize()
        {
            var sw = Stopwatch.StartNew();

            var keepSyncRepos           = _genericRepositories.GetGenericRepository <IKeepSynchronizedMetadata>();
            var oldItems                = keepSyncRepos.Load();
            var skipRecomputeDbMetadata = new HashSet <string>(oldItems.Where(item => item.Context == "NORECOMPUTE").Select(GetComputationKey));

            var skipRecomputeDslConcept = new HashSet <string>(_dslModel.FindByType <SkipRecomputeOnDeployInfo>().Select(GetComputationKey));

            bool skipRecomputeDeployParameter = _deployArguments.SkipRecompute;

            IEnumerable <IKeepSynchronizedMetadata> toInsert, toUpdate, toDelete;

            keepSyncRepos.Diff(oldItems, _currentKeepSynchronizedMetadata, new SameRecord(), SameValue, Assign, out toInsert, out toUpdate, out toDelete);

            _performanceLogger.Write(sw, () => nameof(KeepSynchronizedRecomputeOnDeploy) + ": Load metadata.");

            foreach (var compute in toInsert.Concat(toUpdate))
            {
                if (skipRecomputeDeployParameter)
                {
                    _logger.Info(() => $"Skipped recomputing {compute.Target} from {compute.Source} due to deployment parameter.");
                }
                else if (skipRecomputeDslConcept.Contains(GetComputationKey(compute)))
                {
                    _logger.Info(() => $"Skipped recomputing {compute.Target} from {compute.Source} due to DSL concept.");
                }
                else if (skipRecomputeDbMetadata.Contains(GetComputationKey(compute)))
                {
                    _logger.Info(() => $"Skipped recomputing {compute.Target} from {compute.Source} due to database metadata.");
                }
                else
                {
                    _logger.Info(() => $"Recomputing {compute.Target} from {compute.Source}.");
                    _genericRepositories.GetGenericRepository(compute.Target).RecomputeFrom(compute.Source);
                    _performanceLogger.Write(sw, () => $"{nameof(KeepSynchronizedRecomputeOnDeploy)}: {compute.Target} from {compute.Source}.");
                }
            }

            keepSyncRepos.Save(toInsert, toUpdate, toDelete);
            _performanceLogger.Write(sw, () => nameof(KeepSynchronizedRecomputeOnDeploy) + ": Save metadata.");
        }