public static List> ChunkBy(this List source, int chunkSize)
{
var result = new List>();
for (int i = 0; i < source.Count; i += chunkSize)
{
var rows = new List();
for (int j = i; j < i + chunkSize; j++)
{
if (j >= source.Count) break;
rows.Add(source[j]);
}
result.Add(rows);
}
return result;
}