private WorkflowStep IterateParents(int id, string name) { //todo: filter out circular paths var upstream = _workflowBuilder.GetUpstreamSteps(id); foreach (var parent in upstream) { if (parent.Name == name) { return(parent); } } foreach (var parent in upstream) { var result = IterateParents(parent.Id, name); if (result != null) { return(result); } } return(null); }