private bool ActionExists() { if (!AllMessages.Any()) { return(false); } var topicNames = AllMessages .Select(x => x.Topic.Substring(x.Topic.LastIndexOf("/", StringComparison.InvariantCulture))) .Distinct() .ToList(); if (topicNames.Count > 5) { return(false); } return(topicNames.All(x => ActionTopicNames.Contains(x))); }