public static int RemoveCount(int id, int n, Hashtable ht) { int count = GameHandler.GetCount(id, ht); if(ht.ContainsKey(id)) { ht.Remove(id); } count -= n; if(count > 0) { ht.Add(id, count); } return count; }