async def _create_sync_context(
        cls,
        db: AsyncSession,
        sync: schemas.Sync,
        sync_job: schemas.SyncJob,
        dag: schemas.SyncDag,
        collection: schemas.Collection,
        source_connection: schemas.SourceConnection,
        current_user: schemas.User,
        access_token: Optional[str] = None,
    ) -> SyncContext:
        """Create a sync context.

        Args:
            db: Database session
            sync: The sync configuration
            sync_job: The sync job
            dag: The DAG for the sync
            collection: The collection to sync to
            source_connection: The source connection
            current_user: The current user
            access_token: Optional token to use instead of stored credentials

        Returns:
            SyncContext object with all required components
        """
        # Fetch white label if set in sync
        white_label = None
        if source_connection.white_label_id:
            white_label = await crud.white_label.get(
                db, id=source_connection.white_label_id, current_user=current_user
            )

        source = await cls._create_source_instance(
            db=db,
            sync=sync,
            current_user=current_user,
            white_label=white_label,
            access_token=access_token,
        )
        embedding_model = cls._get_embedding_model(sync=sync)
        destinations = await cls._create_destination_instances(
            db=db,
            sync=sync,
            collection=collection,
            current_user=current_user,
        )
        transformers = await cls._get_transformer_callables(db=db, sync=sync)
        entity_map = await cls._get_entity_definition_map(db=db)

        progress = SyncProgress(sync_job.id)
        router = SyncDAGRouter(dag, entity_map)

        # Create a contextualized logger with sync job metadata
        logger = LoggerConfigurator.configure_logger(
            "airweave.platform.sync",
            dimensions={
                "sync_id": str(sync.id),
                "sync_job_id": str(sync_job.id),
                "user_id": str(current_user.id),
                # "org_id": str(sync.organization_id), TODO: add org id when we have orgs
            },
        )

        return SyncContext(
            source=source,
            destinations=destinations,
            embedding_model=embedding_model,
            transformers=transformers,
            sync=sync,
            sync_job=sync_job,
            dag=dag,
            collection=collection,
            source_connection=source_connection,
            progress=progress,
            router=router,
            entity_map=entity_map,
            current_user=current_user,
            logger=logger,
            white_label=white_label,
        )
Create a sync context.

        Args:
            db: Database session
            sync: The sync configuration
            sync_job: The sync job
            dag: The DAG for the sync
            collection: The collection to sync to
            source_connection: The source connection
            current_user: The current user
            access_token: Optional token to use instead of stored credentials

        Returns:
            SyncContext object with all required components
        
backend/airweave/platform/sync/factory.py