public void NextItem() { var items = wareHouse.GetItems(specialization).Where(x => x.type.Equals(Item.Types.Human) || x.type.Equals(Item.Types.Instrument)).ToList(); if (items.Count == 0) { return; } var currentItemPosition = items.IndexOf(item); if (currentItemPosition == items.Count - 1) { item = items.ElementAt(0); } else { item = items.ElementAt(currentItemPosition + 1); } SetAvailableResources(); }