// Token: 0x060062DB RID: 25307 RVA: 0x001BBFD4 File Offset: 0x001BA1D4
        private static Annotation ProcessHighlights(AnnotationService service, ITextRange textRange, string author, Color?color, bool create)
        {
            Invariant.Assert(textRange != null, "Parameter 'textRange' is null.");
            IList <IAttachedAnnotation> spannedAnnotations = AnnotationHelper.GetSpannedAnnotations(service);

            foreach (IAttachedAnnotation attachedAnnotation in spannedAnnotations)
            {
                if (HighlightComponent.TypeName.Equals(attachedAnnotation.Annotation.AnnotationType))
                {
                    TextAnchor textAnchor = attachedAnnotation.FullyAttachedAnchor as TextAnchor;
                    Invariant.Assert(textAnchor != null, "FullyAttachedAnchor must not be null.");
                    TextAnchor textAnchor2 = new TextAnchor(textAnchor);
                    textAnchor2 = TextAnchor.TrimToRelativeComplement(textAnchor2, textRange.TextSegments);
                    if (textAnchor2 == null || textAnchor2.IsEmpty)
                    {
                        service.Store.DeleteAnnotation(attachedAnnotation.Annotation.Id);
                    }
                    else
                    {
                        AnnotationHelper.SetAnchor(service, attachedAnnotation.Annotation, textAnchor2);
                    }
                }
            }
            if (create)
            {
                Annotation annotation = AnnotationHelper.CreateHighlight(service, textRange, author, color);
                service.Store.AddAnnotation(annotation);
                return(annotation);
            }
            return(null);
        }