/* Detect intermediate refactorings the determined before record. */
        private void DetectIntermediateRefactorings(ICodeHistoryRecord baseBefore, ICodeHistoryRecord head, 
            IExternalRefactoringDetector detector)
        {
            // Get the source code for base before.
            var before = baseBefore.GetSource();

            // From the head, iteratively get previous record (until reach base before record)
            // and detect if refactorings exist.
            for (var currentRecord = head; !currentRecord.Equals(baseBefore);
                currentRecord = currentRecord.GetPreviousRecord())
            {
                var after = currentRecord.GetSource();
                DetectRefactoringByDetector(before, after, detector);
            }
        }
        /* Handle a previous record with the head of the record chain. */
        private bool HandlePreviousRecord(ICodeHistoryRecord previous, ICodeHistoryRecord head, 
            IExternalRefactoringDetector detector)
        {
            var after = head.GetSource();
            var before = previous.GetSource();

            // Detect if a refactoring happens before head and the previous record.
            if (DetectRefactoringByDetector(before, after, detector))
            {
                // If there is a refactoring detected, search intermediate refactorings.
                DetectIntermediateRefactorings(previous, head.GetPreviousRecord(), detector);
                return true;
            }
            return false;
        }
 protected override void OnRefactoringDetected(ICodeHistoryRecord before, ICodeHistoryRecord after,
     IEnumerable<IManualRefactoring> refactorings)
 {
     logger.Info("Rename dectected.");
     logger.Info("\nBefore: \n" + before.GetSource());
     logger.Info("\nAfter: \n" + after.GetSource());
 }
            protected override void OnRefactoringDetected(ICodeHistoryRecord before, ICodeHistoryRecord after,
                IEnumerable<IManualRefactoring> refactorings)
            {
                logger.Info("\n Extract Method dectected.");
                logger.Info("\n Before: \n" + before.GetSource());
                logger.Info("\n After: \n" + after.GetSource());

                // Get the first refactoring detected.
                IManualRefactoring refactoring = refactorings.First();

                // Enqueue workitem for conditions checking component.
                GhostFactorComponents.conditionCheckingComponent.CheckRefactoringCondition(before, after, refactoring);
            }
            protected override void OnRefactoringDetected(ICodeHistoryRecord before, ICodeHistoryRecord after,
                                                          IEnumerable<IManualRefactoring> refactorings)
            {
                logger.Info("Change Method Signature Detected.");
                logger.Info("Before:\n" + before.GetSource());
                logger.Info("After:\n" + after.GetSource());

                // Enqueue the condition checking process for this detected refactoring.
                GhostFactorComponents.conditionCheckingComponent.CheckRefactoringCondition(before, after, refactorings.First());
            }