public static void AttachListener(this IRepositoryManagerListener listener,
                                          IRepositoryManager repositoryManager, RepositoryManagerEvents managerEvents = null, bool trace = true)
        {
            var logger = trace ? LogHelper.GetLogger <IRepositoryManagerListener>() : null;

            repositoryManager.IsBusyChanged += isBusy => {
                logger?.Trace("OnIsBusyChanged: {0}", isBusy);
                listener.OnIsBusyChanged(isBusy);
                if (isBusy)
                {
                    managerEvents?.isBusy.TrySetResult(true);
                }
                else
                {
                    managerEvents?.isNotBusy.TrySetResult(true);
                }
            };

            repositoryManager.CurrentBranchUpdated += (configBranch, configRemote) => {
                logger?.Trace("CurrentBranchUpdated");
                listener.CurrentBranchUpdated(configBranch, configRemote);
                managerEvents?.currentBranchUpdated.TrySetResult(true);
            };

            repositoryManager.GitLocksUpdated += gitLocks => {
                logger?.Trace("GitLocksUpdated");
                listener.GitLocksUpdated(gitLocks);
                managerEvents?.gitLocksUpdated.TrySetResult(true);
            };

            repositoryManager.GitAheadBehindStatusUpdated += gitAheadBehindStatus => {
                logger?.Trace("GitAheadBehindStatusUpdated");
                listener.GitAheadBehindStatusUpdated(gitAheadBehindStatus);
                managerEvents?.gitAheadBehindStatusUpdated.TrySetResult(true);
            };

            repositoryManager.GitStatusUpdated += gitStatus => {
                logger?.Trace("GitStatusUpdated");
                listener.GitStatusUpdated(gitStatus);
                managerEvents?.gitStatusUpdated.TrySetResult(true);
            };

            repositoryManager.GitLogUpdated += gitLogEntries => {
                logger?.Trace("GitLogUpdated");
                listener.GitLogUpdated(gitLogEntries);
                managerEvents?.gitLogUpdated.TrySetResult(true);
            };

            repositoryManager.LocalBranchesUpdated += branchList => {
                logger?.Trace("LocalBranchesUpdated");
                listener.LocalBranchesUpdated(branchList);
                managerEvents?.localBranchesUpdated.TrySetResult(true);
            };

            repositoryManager.RemoteBranchesUpdated += (remotesList, branchList) => {
                logger?.Trace("RemoteBranchesUpdated");
                listener.RemoteBranchesUpdated(remotesList, branchList);
                managerEvents?.remoteBranchesUpdated.TrySetResult(true);
            };
        }