private void GetGateways()
        {
            DisplayMessage("Pobranie gatewayow");
            uxSerialPortList.Items.Clear();
            uxSerialPortStatus.Items.Clear();
            _gateways.Clear();

            _gateways = _gatewayService.GetGateways();

            foreach (var gateway in _gateways)
            {
                lock (SerialPortToken.Instance)
                {
                    try
                    {
                        ReloadSerialPortListAndStatus(gateway);
                        if (!gateway.IsAvailable)
                        {
                            continue;
                        }
                        var response = _gatewayService.GetResponse(gateway);
                        _gatewayRepository.InsertGatewayResponse(gateway, response);
                    }
                    catch (NpgsqlException ex)
                    {
                        if (_isSendEmail)
                        {
                            continue;
                        }
                        try
                        {
                            IncreaseErrorCounter();
                            DisplayMessage(ex.Message);
                            _emailService.SendEmail("Błąd połączenia z bazą danych", ex.Message);
                            _isSendEmail = true;
                        }
                        catch (Exception innerEx)
                        {
                            DisplayMessage(innerEx.Message);
                        }
                    }
                    catch (Exception ex)
                    {
                        IncreaseErrorCounter();
                        DisplayMessage(ex.Message);
                    }
                }
            }
        }