https://sd.blackball.lv/ru/articles/read/18930-linq-how-to-avoid-nested-loops-in-csharp