private int GetAvailableSlot() { for (int i = 1; i <= this.MaxSize; i++) { if (!_occupiedSlots.ContainsKey(i)) return i; } throw new Exception("No free slot found."); }