public ActionResult Details(int id)
        {
            var product = _productsRepository.GetProduct(id);

            if (product == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.NotFound);
            }

            IEnumerable<Promotion> promotions = null;
            CustomerRec customer = null;

            var relatedProducts = _productsRepository.GetRelatedProducts(product.Id);

            var clickEvent = new ClickEvent
            {
                ClickTime = DateTime.Now,
                ProductId = product.Id
            };

            _telemetryRepository.SendClick(clickEvent);

            if (User.Identity.IsAuthenticated)
            {
                customer = _customerRepository.GetCustomerByName(User.Identity.Name);
                promotions = _promotionsRepository.GetPromotions(customer.CustomerId);
            }

            var relatedCatalogItems = relatedProducts
                .OrderBy(p => p.Name)
                .Select(relatedProduct => ProductToCatalogItem(promotions, customer, relatedProduct))
                .ToList();

            return View(new CatalogItemDetailsModel(ProductToCatalogItem(promotions, customer, product), relatedCatalogItems));
        }
        public void SendClick(ClickEvent click)
        {
            var serializedString = JsonConvert.SerializeObject(click);

            var data = new EventData(Encoding.UTF8.GetBytes(serializedString))
            {
                PartitionKey = click.ProductId.ToString()
            };

            // Set user properties if needed
            data.Properties.Add("Type", "Telemetry_" + DateTime.UtcNow.ToLongTimeString());

            _eventHubs.ClickClient.Send(data);
        }