public void DataMaintenance(Order anOrder, DB.DBOperation operation) { int index = 0; //perform a given database operation to the dataset in meory; orderDB.DataSetChange(anOrder, operation); //perform operations on the collection switch (operation) { case DB.DBOperation.Add: //*** Add the employee to the Collection orders.Add(anOrder); break; case DB.DBOperation.Edit: index = FindIndex(anOrder); orders[index] = anOrder; // replace employee at this index with the updated employee break; } }