// returns:  A dictionary mapping localized service types to an array of all services of that type.
        public static Dictionary <string, List <HMService> > GetServiceTable(this HMHome self)
        {
            var serviceDictionary = new Dictionary <string, List <HMService> > ();

            foreach (var service in self.GetAllServices())
            {
                if (!service.IsControllType())
                {
                    continue;
                }

                var serviceType = service.LocalizedDescription;
                List <HMService> list;
                if (serviceDictionary.TryGetValue(serviceType, out list))
                {
                    list.Add(service);
                }
                else
                {
                    serviceDictionary [serviceType] = new List <HMService> {
                        service
                    }
                };
            }

            foreach (var list in serviceDictionary.Values)
            {
                list.Sort((x, y) => x.Name.CompareTo(y.Name));
            }

            return(serviceDictionary);
        }
        // returns:  A list of services that exist in the home and have not yet been added to this service group.
        public static IEnumerable <HMService> ServicesNotAlreadyInServiceGroup(this HMHome self, HMServiceGroup serviceGroup)
        {
            var servicesInGroup           = new HashSet <HMService> (serviceGroup.Services);
            Func <HMService, bool> filter = s => !servicesInGroup.Contains(s) && s.ServiceType != HMServiceType.AccessoryInformation;

            return(self.GetAllServices().Where(filter));
        }