private static void AddAnnotationWithMerge(MetadataItem metadataItem, IndexAnnotation newAnnotation) { var existingAnnotation = metadataItem.Annotations.GetAnnotation(XmlConstants.IndexAnnotationWithPrefix); if (existingAnnotation != null) { newAnnotation = (IndexAnnotation)((IndexAnnotation)existingAnnotation).MergeWith(newAnnotation); } metadataItem.AddAnnotation(XmlConstants.IndexAnnotationWithPrefix, newAnnotation); }