ICollection <POFineLineSkuOutput> ITypeConverter <POO, ICollection <POFineLineSkuOutput> > .Convert(POO source, ICollection <POFineLineSkuOutput> destination, ResolutionContext context)
        {
            List <POFineLineSkuOutput> poFLSkus = new List <POFineLineSkuOutput>();

            source.POSkus?.ToList().ForEach(x =>
            {
                POFineLineProductOutput poFlProduct = new POFineLineProductOutput
                {
                    VendorNumber        = x.POProduct.APVendor,
                    SubVendorNumber     = x.POProduct.SubVendor,
                    SKUDescription      = x.POProduct.SkuDescShrt,
                    VendorStyleNumber   = x.POProduct.VendorSkuCode,
                    TicketType          = x.POProduct.LabelType,
                    TicketDescription   = x.POProduct.LabelDescription,
                    ClassID             = x.POProduct.Class,
                    ClassDescription    = x.POProduct.ClassDescription,
                    SubClassID          = x.POProduct.SubClass,
                    SubClassDescription = x.POProduct.SubclassDescription,
                    Size           = x.POProduct.Size,
                    ISOCountryCode = x.POProduct.CountryOfOrigin,
                    TicketRetail   = x.GetRetailPrice()
                };
                poFLSkus.Add(new POFineLineSkuOutput
                {
                    SKUNumber               = x.SKU,
                    PurchaseOrderDate       = x.CreateDate != null ? x.CreateDate.Value : new DateTime?(),
                    PurchaseOrderReviseDate = x.ModifiedDate != null ? x.ModifiedDate.Value : new DateTime?(),
                    OrderQuantity           = x.BuyQuantity != null ? Convert.ToInt32(x.BuyQuantity) : 0,
                    StatusCode              = x.StatusCode,
                    POProduct               = poFlProduct
                });
            });

            return(poFLSkus);
        }
        public async Task <POFineLineOutput> UpdatePOObject(POFineLineOutput poobject, MMSProductEvent product, POSkus posku)
        {
            try
            {
                var prodhierarchy = await _lookUpService.GetProductHierarchy(product.SubClass);

                var productlabel = await _lookUpService.GetProductLabelDescription(product.LabelType);

                //check if exists
                if (poobject.POSkus != null && poobject.POSkus.Count > 0 && poobject.POSkus.Exists(y => y.SKUNumber == posku.SKU))
                {
                    var poskutobeupdated = poobject.POSkus.Find(y => y.SKUNumber == posku.SKU);
                    poskutobeupdated.POProduct.SKUDescription    = product?.SkuDescShrt;
                    poskutobeupdated.POProduct.SubClassID        = product?.SubClass;
                    poskutobeupdated.POProduct.TicketType        = productlabel?.Code;
                    poskutobeupdated.POProduct.TicketDescription = productlabel?.Description;
                    poskutobeupdated.POProduct.VendorNumber      = posku.POProduct?.APVendor;
                    poskutobeupdated.POProduct.Size                = product?.Size;
                    poskutobeupdated.POProduct.ISOCountryCode      = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.CountryOfOrigin;
                    poskutobeupdated.POProduct.ClassID             = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Class;
                    poskutobeupdated.POProduct.ClassDescription    = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Description;
                    poskutobeupdated.POProduct.VendorStyleNumber   = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.VendorSkuCode;
                    poskutobeupdated.POProduct.SubClassDescription = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.SubclassDescription;
                    poskutobeupdated.POProduct.SubVendorNumber     = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.SubVendor;
                    poskutobeupdated.POProduct.TicketRetail        = posku.GetRetailPrice();
                    return(poobject);
                }
                else
                {
                    POFineLineProductOutput poFLProductOutput = new POFineLineProductOutput
                    {
                        VendorNumber        = posku.POProduct?.APVendor,
                        SubVendorNumber     = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.SubVendor,
                        SKUDescription      = product?.SkuDescShrt,
                        VendorStyleNumber   = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.VendorSkuCode,
                        TicketType          = productlabel?.Code,
                        TicketDescription   = productlabel?.Description,
                        ClassID             = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Class,
                        ClassDescription    = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.Description,
                        SubClassID          = product?.SubClass,
                        SubClassDescription = prodhierarchy?.Find(y => y.SubClass == product?.SubClass)?.SubclassDescription,
                        Size           = product?.Size,
                        ISOCountryCode = product.ProductVendors?.Find(y => y.Sku == posku.SKU)?.CountryOfOrigin,
                        TicketRetail   = posku.GetRetailPrice()
                    };
                    POFineLineSkuOutput POFLSkusOutput = new POFineLineSkuOutput
                    {
                        SKUNumber               = posku.SKU,
                        PurchaseOrderDate       = posku.CreateDate != null ? posku.CreateDate.Value : new DateTime?(),
                        PurchaseOrderReviseDate = posku.ModifiedDate != null ? posku.ModifiedDate.Value : new DateTime?(),
                        OrderQuantity           = posku.BuyQuantity != null?Convert.ToInt32(posku.BuyQuantity) : 0,
                        POProduct               = poFLProductOutput,
                        StatusCode              = posku.StatusCode,
                    };

                    if (poobject.POSkus == null)
                    {
                        poobject.POSkus = new System.Collections.Generic.List <POFineLineSkuOutput>();
                    }
                    poobject.POSkus.Add(POFLSkusOutput);
                    return(poobject);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "UpdatePOObject - Failed Updating FineLinePO: {Reason} -- {PONumber} -- {Sku }", ex.Message, poobject.PurchaseOrder, posku.SKU);
                return(null);
            }
        }