public IActionResult Load(long?ID, long?ProductID, long?ProductDetailID, long?AttachmentLevel, long?langId)
        {
            GetProductAttachments operation = new GetProductAttachments();

            operation.ID              = ID;
            operation.ProductId       = ProductID;
            operation.ProductDetailId = ProductDetailID;
            operation.AttachmentLevel = AttachmentLevel;
            if (langId.HasValue)
            {
                operation.LangID = langId;
            }
            else
            {
                operation.LangID = 1;
            }

            var result = operation.QueryAsync().Result;

            if (result is ValidationsOutput)
            {
                return(Ok(new ApiResult <List <ValidationItem> >()
                {
                    Data = ((ValidationsOutput)result).Errors
                }));
            }
            else
            {
                return(Ok((List <ProductAttachment>)result));
            }
        }
        public IActionResult LoadUnRelated(long?ID, long?ProductID, long?ProductDetailID, long?AttachmentLevel, long?langId)
        {
            GetProductAttachments operation  = new GetProductAttachments();
            GetAttachments        operation2 = new GetAttachments();

            operation.ID              = ID;
            operation.ProductId       = ProductID;
            operation.ProductDetailId = ProductDetailID;
            operation.AttachmentLevel = AttachmentLevel;

            if (langId.HasValue)
            {
                operation.LangID  = langId;
                operation2.LangID = langId;
            }
            else
            {
                operation.LangID  = 1;
                operation2.LangID = 1;
            }

            var result  = operation.QueryAsync().Result;
            var result2 = (List <Attachment>)operation2.QueryAsync().Result;

            List <ProductAttachment> RelatedAttachment   = new List <ProductAttachment>();
            List <Attachment>        UnRelatedAttachment = new List <Attachment>();



            var productAttachment = (List <ProductAttachment>)result;


            if (productAttachment.Count > 0)
            {
                RelatedAttachment = productAttachment.Where(p => result2.Any(s => s.ID == p.AttachmentID)).ToList();

                UnRelatedAttachment = result2.Where(s => productAttachment.Any(p => p.AttachmentID != s.ID)).ToList();

                UnRelatedAttachment = UnRelatedAttachment.Where(un => !RelatedAttachment.Exists(re => un.ID == re.AttachmentID)).ToList();
            }
            else
            {
                UnRelatedAttachment = result2;
            }


            if (result is ValidationsOutput)
            {
                return(Ok(new ApiResult <List <ValidationItem> >()
                {
                    Data = ((ValidationsOutput)result).Errors
                }));
            }
            else
            {
                return(Ok(new { RelatedAttachment, UnRelatedAttachment }));
            }
        }