private string GetPostUrl(ArduinoInfo to)
        {
            var ip   = to.IP.ToString();
            var port = to.Port;

            return($"http://{ip}:{port}");
        }
        public void Emit(ArduinoInfo to, string eventName, object eventValue)
        {
            var content = GetPostContent(eventName, eventValue);
            var url     = GetPostUrl(to);

            _client.PostAsync(url, content);
        }
        public void Register(ArduinoInfo arduino)
        {
            var exists = GetArduino(arduino.UniqueIdentifier) != null;

            if (exists)
            {
                throw new ApplicationException("Arduino already registered in database");
            }

            _collection.InsertOne(arduino);

            _eventBus.Publish(new ArduinoAddedEvent(arduino));
        }