public static IEnumerable> SplitIntoSets
(this IEnumerable source, int itemsPerSet)
{
var sourceList = source as List ?? source.ToList();
for (var index = 0; index < sourceList.Count; index += itemsPerSet)
{
yield return sourceList.Skip(index).Take(itemsPerSet);
}
}