public string Stringify(string resource) { var pathinfo = AllKeys.Aggregate(resource, (current, key) => Regex.Replace(current, $@"\[{key}\]", Get(key))); if (pathinfo.Contains("[") || pathinfo.Contains("]")) { throw new ClientStateException($"Not all parameters were replaced in request resource: {pathinfo}"); } return(pathinfo); }