private static ActivityStateQuery MatchActivityState(ActivityStateRecord activityRecord, ReadOnlyCollection <ActivityStateQuery> subscriptions) { ActivityStateQuery genericMatch = null; for (int i = 0; i < subscriptions.Count; i++) { if (subscriptions[i].States.Contains(activityRecord.State)) { return(subscriptions[i]); } else if (subscriptions[i].States.Contains("*")) { if (genericMatch == null) { genericMatch = subscriptions[i]; } } } return(genericMatch); }