/// <summary>
        /// Save And Update Truck Document Details
        /// </summary>
        /// <param name="listTruckDetails"></param>
        public void SaveAndUpdateTruckDocumentDetails(IList<TruckDocDetailsDTO> listTruckDetail,
            IList<TruckDocumentsDTO> listTruckDocument)
        {
            using (TransactionScope transactionScope = new TransactionScope())
            {
                for (int i = 0; i < listTruckDetail.Count; i++)
                {
                    truckdocdetail truckDocDetailsEntity = new truckdocdetail();

                    TruckDocService truckDocuments = new TruckDocService();
                    TruckDocDetailsDTO truckDocDetail = truckDocuments.GetTruckDocDetailsByTruckIdAndDocId(
                        listTruckDetail[i].Truck_Doc_TruckId, listTruckDetail[i].Truck_Doc_DocId);

                    if (truckDocDetail.Truck_Doc_Id > 0)
                    {
                        AutoMapper.Mapper.Map(truckDocDetail, truckDocDetailsEntity);

                        truckDocDetailsEntity.Truck_Doc_DocNo = listTruckDetail[i].Truck_Doc_DocNo;
                        truckDocDetailsEntity.Truck_Doc_ExDate = listTruckDetail[i].Truck_Doc_ExDate;
                        truckDocDetailsEntity.Truck_Doc_FileName = listTruckDetail[i].Truck_Doc_FileName;
                        truckDocDetailsEntity.Truck_Doc_CreatedBy = listTruckDetail[i].Truck_Doc_CreatedBy;
                        truckDocDetailsEntity.Truck_Doc_CreatedDate = listTruckDetail[i].Truck_Doc_CreatedDate;
                        truckDocDetailsEntity.Truck_Doc_LastUpdatedDate = listTruckDetail[i].Truck_Doc_LastUpdatedDate;
                        ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocdetail>>().Update(truckDocDetailsEntity);
                    }
                    else
                    {
                        AutoMapper.Mapper.Map(listTruckDetail[i], truckDocDetailsEntity);
                        ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocdetail>>().Save(truckDocDetailsEntity);
                    }

                    TruckDocumentsDTO truckDocument = truckDocuments.GetTruckDocDetailsByTruckDocId(truckDocDetailsEntity.Truck_Doc_Id);
                    truckdocument truckDocumentEntity = new truckdocument();

                    if (truckDocument.TruckDoc_Id > 0)
                    {
                        AutoMapper.Mapper.Map(truckDocument, truckDocumentEntity);
                        if (listTruckDocument[i].TruckDoc_File == null)
                        {
                            truckDocumentEntity.TruckDoc_IsDeleted = true;
                        }
                        else
                        {
                            truckDocumentEntity.TruckDoc_File = listTruckDocument[i].TruckDoc_File;
                            truckDocumentEntity.TruckDoc_IsDeleted = false;
                        }
                        ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocument>>().Update(truckDocumentEntity);
                    }
                    else
                    {
                        AutoMapper.Mapper.Map(listTruckDocument[i], truckDocumentEntity);

                        truckDocumentEntity.TruckDoc_Doc_Id = truckDocDetailsEntity.Truck_Doc_Id;

                        ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocument>>().Save(truckDocumentEntity);
                    }
                }
                transactionScope.Complete();
            }
        }
        /// <summary>
        /// Delete Truck Doc Details
        /// </summary>
        /// <param name="truckDocs"></param>
        private static void DeleteTruckDocDetails(TruckDocDetailsDTO truckDocs)
        {
            truckdocdetail truckDocEntity = new truckdocdetail();
            AutoMapper.Mapper.Map(truckDocs, truckDocEntity);

            ESalesUnityContainer.Container.Resolve<IGenericRepository<truckdocdetail>>().Update(truckDocEntity);
        }