internal void ProcessBranches(object state)
        {
            while (true)
            {
                Branch branch;
                lock (mSyncLock)
                {
                    if (!BranchesQueueStorage.HasQueuedBranches(mBranchesQueueFilePath))
                    {
                        Monitor.Wait(mSyncLock, 1000);
                        continue;
                    }

                    branch          = BranchesQueueStorage.DequeueBranch(mBranchesQueueFilePath);
                    branch.FullName = FindQueries.GetBranchName(
                        mRestApi, branch.Repository, branch.Id);
                }

                mLog.InfoFormat("Processing branch {0} attribute change...", branch.FullName);
                ProcessBranch.Result result = ProcessBranch.TryProcessBranch(
                    mRestApi, branch, mTrunkBotConfig, mBotName, mCodeReviewsTrackedFilePath);

                if (result == ProcessBranch.Result.Ok)
                {
                    mLog.InfoFormat("Branch {0} processing completed.", branch.FullName);
                    continue;
                }

                if (result == ProcessBranch.Result.Failed)
                {
                    mLog.InfoFormat("Branch {0} processing failed.", branch.FullName);
                    continue;
                }

                mLog.InfoFormat("Branch {0} is not ready. It will be queued again.", branch.FullName);

                lock (mSyncLock)
                {
                    if (BranchesQueueStorage.Contains(
                            branch.Repository, branch.Id,
                            mBranchesQueueFilePath))
                    {
                        continue;
                    }

                    BranchesQueueStorage.EnqueueBranch(
                        branch, mBranchesQueueFilePath);
                }

                Thread.Sleep(5000);
            }
        }