public List <Potion> GetPotions(int characterID) { List <object[]> data = context.GetPotions(characterID); List <Potion> potions = new List <Potion>(); foreach (object[] row in data) { for (int i = 0; i < Convert.ToInt32(data[5]); i++) { potions.Add(new Potion(Convert.ToInt32(row[0]), row[1].ToString(), Convert.ToInt32(row[2]), row[3].ToString(), Convert.ToInt32(row[4]))); } } return(potions); }