/// <summary>
        /// Takes an xml node which describes a homestore app and returns
        /// a HomeStoreApp structure
        /// </summary>
        /// <param name="xmlDevice">the xml subtree of the app</param>
        /// <returns>The relevant HomeStoreApp structure</returns>
        public static HomeStoreDevice ReadHomeStoreDeviceFromXml(Uri baseUri, XmlElement xmlDevice)
        {
            if (!xmlDevice.Name.Equals("Device"))
                throw new Exception("child is not a Device in " + xmlDevice);

            HomeStoreDevice homeStoreDev = new HomeStoreDevice();

            homeStoreDev.DeviceName = xmlDevice.GetAttribute("DeviceName");
            homeStoreDev.ManufacturerName = xmlDevice.GetAttribute("ManufacturerName");
            homeStoreDev.Description = xmlDevice.GetAttribute("Description");
            homeStoreDev.Rating = int.Parse(xmlDevice.GetAttribute("Rating"));
            homeStoreDev.Model = xmlDevice.GetAttribute("Model");
            try
            {
                string iconUrlString = xmlDevice.GetAttribute("IconUrl");
                if (!iconUrlString.Equals(""))
                {
                    homeStoreDev.IconUrl = new Uri(baseUri, xmlDevice.GetAttribute("IconUrl")).ToString();
                }
                else
                {
                    homeStoreDev.IconUrl = null;
                }
            }
            catch (Exception)
            {
                homeStoreDev.IconUrl = null;
            }

            homeStoreDev.Roles = new List<string>();
            homeStoreDev.ValidDrivers = new List<string>();

            foreach (XmlElement child in xmlDevice.ChildNodes)
            {
                if (child.Name.Equals("RoleList"))
                {
                    foreach (XmlElement role in child)
                    {
                        if (role.Name.Equals("Role"))
                        {
                            homeStoreDev.Roles.Add(role.GetAttribute("Name"));
                        }
                    }
                }
                else if (child.Name.Equals("DriverList"))
                {
                    foreach (XmlElement driver in child)
                    {
                        if (driver.Name.Equals("Driver"))
                        {
                            homeStoreDev.ValidDrivers.Add(driver.GetAttribute("Name"));
                        }
                    }
                }
            }

            return homeStoreDev;
        }
 private void AddDeviceToDB(HomeStoreDevice dev)
 {
     deviceDb.Add(dev.DeviceName, dev);
 }