protected override Task OnChangeRoleAsync(ReplicaRole newRole, CancellationToken cancellationToken) { if (newRole != ReplicaRole.Primary) { BackupRestoreTrace.TraceSource.WriteInfo(TraceType, "Stoping the WorkItem Handler"); WorkItemHandler.StopWorkItemHandler(); BackupRestoreTrace.TraceSource.WriteInfo(TraceType, "Stopped the WorkItem Handler"); } return(base.OnChangeRoleAsync(newRole, cancellationToken)); }