public void LinkProduct(int idConnector, string productName)
        {
            UnitOfWork repository = UnitOfWork.GetInstance();

            Connector connector = repository.ConnectorRepository.GetById(idConnector);

            if (connector == null)
            {
                throw new ArgumentException("The connector isn't exist");
            }

            if (connector.InUse)
            {
                throw  new Exception("The connector is being used by other HomeDevice or product");
            }

            Type product = BusinessProduct.GetProductType(productName);

            if (!connector.IsCapable(product))
            {
                throw new Exception("The product is not capable with this connector");
            }

            connector.LinkHomeDevice(product);

            repository.Commit();
        }
        public IEnumerable <ConnectorDTO> GetConnectorsCapableProduct(int idNode, string productName)
        {
            UnitOfWork repository = UnitOfWork.GetInstance();

            Node node = repository.NodeRespository.GetById(idNode);

            if (node == null)
            {
                throw new ArgumentException("Node doesn't exist");
            }

            Type product = BusinessProduct.GetProductType(productName);

            var connectors = node.Connectors.Where(c => !c.InUse && c.IsCapable(product));

            return(Mapper.Map <IEnumerable <ConnectorDTO> >(connectors));
        }