public void Import(StreamReader csvData)
        {
            List <Device> parsedDevices = new List <Device>();
            Dictionary <string, string> detectedNamesBySerial      = new Dictionary <string, string>();
            Dictionary <string, string> detectedFacilitiesBySerial = new Dictionary <string, string>();

            using (CsvReader csv = new CsvReader(csvData, CultureInfo.InvariantCulture))
            {
                var fileFormatDefinition = new
                {
                    serialNumber       = string.Empty,
                    model              = string.Empty,
                    annotatedLocation  = string.Empty,
                    annotatedAssetId   = string.Empty,
                    ethernetMacAddress = string.Empty,
                    macAddress         = string.Empty
                };


                var records = csv.GetRecords(fileFormatDefinition);

                foreach (var o in records)
                {
                    if (!string.IsNullOrEmpty(o.serialNumber))
                    {
                        // Extract the device records
                        parsedDevices.Add(new Device()
                        {
                            SerialNumber = o.serialNumber,
                            Model        = o.model
                        });

                        // Extract device names
                        if (!detectedNamesBySerial.ContainsKey(o.annotatedAssetId))
                        {
                            detectedNamesBySerial.Add(o.serialNumber, o.annotatedAssetId);
                        }

                        // Extract the facility records
                        if (!detectedFacilitiesBySerial.ContainsKey(o.annotatedLocation))
                        {
                            detectedFacilitiesBySerial.Add(o.serialNumber, o.annotatedLocation);
                        }

                        // Extract the MAC addresses
                    }
                }
            }

            ImportHandler importHandler = new ImportHandler(_connstring);

            importHandler.Import(
                parsedDevices,
                detectedNamesBySerial,
                detectedFacilitiesBySerial
                );
        }
        public void Import(StreamReader csvData, string FacilityName)
        {
            List <Device> parsedDevices = new List <Device>();
            Dictionary <string, string> detectedNamesBySerial      = new Dictionary <string, string>();
            Dictionary <string, string> detectedFacilitiesBySerial = new Dictionary <string, string>();

            using (CsvReader csv = new CsvReader(csvData, CultureInfo.InvariantCulture))
            {
                var fileFormatDefinition = new
                {
                    Name   = string.Empty,
                    Model  = string.Empty,
                    Serial = string.Empty
                };

                var records = csv.GetRecords(fileFormatDefinition);

                foreach (var o in records)
                {
                    if (!string.IsNullOrEmpty(o.Serial))
                    {
                        // Extract the device records
                        parsedDevices.Add(new Device()
                        {
                            SerialNumber = o.Serial,
                            Model        = o.Model
                        });

                        // Extract device names
                        if (!detectedNamesBySerial.ContainsKey(o.Serial))
                        {
                            detectedNamesBySerial.Add(o.Serial, o.Name);
                        }

                        // Extract the facility records
                        if (!detectedFacilitiesBySerial.ContainsKey(o.Serial))
                        {
                            detectedFacilitiesBySerial.Add(o.Serial, FacilityName);
                        }
                    }
                }
            }

            ImportHandler importHandler = new ImportHandler(_connstring);

            importHandler.Import(
                parsedDevices,
                detectedNamesBySerial,
                detectedFacilitiesBySerial
                );
        }