private Product GetProductFromBDC(string sku)
        {
            Product product;

            try
            {
                IEntityInstance productInstance = ProductEntity.FindSpecific(sku, ProductCatalogSystem);

                product                    = new Product();
                product.CategoryId         = (string)productInstance["CategoryId"];
                product.ImagePath          = (string)productInstance["ImagePath"];
                product.LongDescription    = (string)productInstance["LongDescription"];
                product.ShortDescription   = (string)productInstance["ShortDescription"];
                product.Name               = (string)productInstance["Name"];
                product.Sku                = (string)productInstance["Sku"];
                product.ThumbnailImagePath = (string)productInstance["ThumbnailImagePath"];
            }
            catch (ObjectNotFoundException ex)
            {
                string errorMessage = string.Format(CultureInfo.CurrentUICulture, "Sku '{0}' could not be found.", sku);
                logger.LogToOperations(ex, errorMessage, (int)EventLogEventId.SkuNotFound);
                return(null);
            }
            return(product);
        }
        /// <summary>
        /// Gets the parts for a particular product specified by it's sku.
        /// </summary>
        /// <param name="sku">The sku to retrieve parts for.</param>
        /// <returns>The parts for this product.</returns>
        public IEnumerable <Part> GetPartsByProductSku(string sku)
        {
            List <Part> parts = new List <Part>();

            IEntityInstance          sourceProduct = ProductEntity.FindSpecific(sku, ProductCatalogSystem);
            EntityInstanceCollection source        = new EntityInstanceCollection();

            if (source != null)
            {
                source.Add(sourceProduct);
            }

            IEntityInstanceEnumerator entitiesEnumerator = PartEntity.FindAssociated(source, ProductCatalogSystem);

            while (entitiesEnumerator.MoveNext())
            {
                IEntityInstance partInstance = entitiesEnumerator.Current;

                Part part = new Part();
                part.Name   = (string)partInstance["Name"];
                part.PartId = (string)partInstance["PartId"];
                parts.Add(part);
            }

            return(parts);
        }