public void DataMaintenance(Account aAccount, DB.DBOperation operation) { int index = 0; //perform a given database operation to the dataset in meory; accountDB.DataSetChange(aAccount, operation); //perform operations on the collection switch (operation) { case DB.DBOperation.Add: //*** Add the Guest to the Collection accounts.Add(aAccount); break; case DB.DBOperation.Edit: index = FindIndex(aAccount); accounts[index] = aAccount; // replace Guest at this index with the updated Guest break; case DB.DBOperation.Delete: index = FindIndex(aAccount); // find the index of the specific Guest in collection accounts.RemoveAt(index); // remove that Guest form the collection break; } }