public SearchResult Search(string input) { var searchInput = _caseSensitive ? input : input.ToLowerInvariant(); var matches = _map.GetCommands(searchInput).OrderByDescending(x => x.Command.Priority).ToImmutableArray(); if (matches.Length > 0) { return(SearchResult.FromSuccess(input, matches)); } return(SearchResult.FromError(CommandError.UnknownCommand, "Unknown command.")); }