/// <summary>
        /// Matches all sensors from existing and new that have the same name
        /// </summary>
        private void SensorMatch()
        {
            if (_runSensorMatch || NewSensors.Count == 0 || ExistingSensors.Count == 0)
            {
                return;
            }
            _runSensorMatch = true;

            var matchesMade = new List <SensorMatch>();

            foreach (var newSensor in NewSensors)
            {
                var matchingExistingSensor = ExistingSensors.FirstOrDefault(x => x.Name == newSensor.Name);
                if (matchingExistingSensor == null)
                {
                    continue;
                }
                if (matchesMade.FirstOrDefault(x => x.ExistingSensor == matchingExistingSensor) == null)
                {
                    matchesMade.Add(new SensorMatch(matchingExistingSensor, newSensor));
                }
            }

            foreach (var sensorMatch in matchesMade)
            {
                ExistingSensors.Remove(sensorMatch.ExistingSensor);
                NewSensors.Remove(sensorMatch.MatchingSensor);
            }

            ExistingSensors = new List <Sensor>(ExistingSensors);
            NewSensors      = new List <Sensor>(NewSensors);

            SensorLinks = new List <SensorMatch>(matchesMade);
        }
        /// <summary>
        /// Makes a link between two sensors
        /// </summary>
        /// <param name="existing">The existing sensor</param>
        /// <param name="matching">The matching new sensor</param>
        private void MakeLink(Sensor existing, Sensor matching)
        {
            Debug.Print("Existing {0} Matching {1} Existing in list {2} Matching in list {3}", existing, matching, ExistingSensors.Contains(existing), NewSensors.Contains(matching));
            if (existing == null || matching == null || !ExistingSensors.Contains(existing) || !NewSensors.Contains(matching))
            {
                return;
            }

            SensorLinks.Add(new SensorMatch(existing, matching));
            SensorLinks = new List <SensorMatch>(SensorLinks);

            ExistingSensors.Remove(existing);
            ExistingSensors = new List <Sensor>(ExistingSensors);
            NewSensors.Remove(matching);
            NewSensors = new List <Sensor>(NewSensors);
        }
        /// <summary>
        /// Removes the currently selected sensor link
        /// </summary>
        public void RemoveLink()
        {
            if (SelectedSensorMatch == null || !SensorLinks.Contains(SelectedSensorMatch))
            {
                return;
            }

            ExistingSensors.Add(SelectedSensorMatch.ExistingSensor);
            ExistingSensors = new List <Sensor>(ExistingSensors);

            NewSensors.Add(SelectedSensorMatch.MatchingSensor);
            NewSensors = new List <Sensor>(NewSensors);

            SensorLinks.Remove(SelectedSensorMatch);
            SensorLinks = new List <SensorMatch>(SensorLinks);
        }