public static int GetNextKey(Dictionary<int, List<int>> models, int currentModel)
{
bool found = true;
foreach (int key in models.Keys)
{
if (found) return key;
if (key == currentModel)
{
found = true;
}
}
// either the current key is the last one or we hit an error. Return the first key.
foreach (int key in models.Keys)
{
return key;
}
return -1;
}