private void AddTags(string message, TaxonomyValueCollection taxonomyValueCollection) { var hashTags = message.Split(' ').Where(token => token.StartsWith("#", StringComparison.OrdinalIgnoreCase)).Select(hashTag => hashTag.Remove(0, 1)); foreach (string hashTag in hashTags) { var correspondingTaxonomyValue = this._taxonomyService.GetTaxonomyValueForLabel(SPContext.Current.Site, ProjectTaxonomy.TermStoreGroupName, ProjectTaxonomy.WallTermSetName, hashTag); if (correspondingTaxonomyValue != null) { // A term with that label actually exists - use it as tag taxonomyValueCollection.Add(correspondingTaxonomyValue); } } }