private static IEnumerable<Issue> GetAllRelatedIssuesUpwards(Issue issue, IReadOnlyList<Issue> all)
        {
            var result = new List<Issue>();

            foreach (var id in issue.LinksTo)
            {
                var parent = all.Single(x => x.Id == id);

                result.Add(parent);

                foreach (var ancestor in GetAllRelatedIssuesUpwards(parent, all))
                {
                    result.Add(ancestor);
                }
            }

            return result;
        }
 private static IEnumerable<Issue> GetAllRelatedIssues(Issue issue, IReadOnlyList<Issue> all)
 {
     return GetAllRelatedIssuesUpwards(issue, all)
         .Union(GetAllRelatedIssuesDownwards(issue, all))
         .Union(new[] { issue });
 }
        private static IEnumerable<Issue> GetAllRelatedIssuesDownwards(Issue issue, IReadOnlyList<Issue> all)
        {
            var children = all.Where(x => x.LinksTo.Contains(issue.Id));

            foreach (var child in children)
            {
                yield return child;

                foreach (var descendant in GetAllRelatedIssuesDownwards(child, all))
                {
                    yield return descendant;
                }
            }
        }