public void Remove(ITerminal terminal) { if (terminal == null) { return; } var port = GetPort(terminal); if (port == null) { return; } var connection = GetLastConnectionInfo(terminal.PhoneNumber); InterruptConnection(connection); UnmapPort(port); port.State = PortState.Off; port.EventsClear(); terminal.EventsClear(); _terminals.Remove(terminal); }