private static void Stop(string queue, bool firstOnly) { Console.WriteLine($"Stopping"); var tasks = JArray.Parse(relay.GetAllTasks()); foreach (var t in tasks) { if (t["queue_id"].Value <string>() == queue) { var id = t["_id"].Value <string>(); relay.CancelTask(id); if (firstOnly) { return; } } } }