public async Task Synchronize(ISynchronizationLogger logger, TContext synchronizationContext) { s_logger.InfoFormat("Entered. Syncstrategy '{0}' with Atype='{1}' and Btype='{2}'", _initialSyncStateCreationStrategy.GetType().Name, typeof(TAtypeEntity).Name, typeof(TBtypeEntity).Name); using (var totalProgress = _totalProgressFactory.Create()) { var knownEntityRelations = _entityRelationDataAccess.LoadEntityRelationData() ?? new IEntityRelationData <TAtypeEntityId, TAtypeEntityVersion, TBtypeEntityId, TBtypeEntityVersion>[] { }; using (var interceptor = _synchronizationInterceptorFactory.Create()) { var newAVersionsTask = _atypeRepository.GetAllVersions(knownEntityRelations.Select(r => r.AtypeId), synchronizationContext); var newBVersionsTask = _btypeRepository.GetAllVersions(knownEntityRelations.Select(r => r.BtypeId), synchronizationContext); var newAVersions = CreateDictionary( await newAVersionsTask, _atypeIdComparer); var newBVersions = CreateDictionary( await newBVersionsTask, _btypeIdComparer); await Synchronize( totalProgress, knownEntityRelations, newAVersions, newBVersions, logger, synchronizationContext, interceptor, newEntityRelations => _entityRelationDataAccess.SaveEntityRelationData(newEntityRelations)); } } s_logger.DebugFormat("Exiting."); }