public void Delete(FileAttachmentModel entity, Guid AttachGroupID)
        {
            objAttachment = new CRM_AttachmentRepository();

            if (objAttachment.GetAll(a => a.AttachGroupID == AttachGroupID && a.AttachFileID == entity.AttachFileID).Count() > 0)
            {
                CRM_Attachments deleteRecord = objAttachment.GetSingle(a => a.AttachGroupID == AttachGroupID && a.AttachFileID == entity.AttachFileID);

                objAttachment.Delete(deleteRecord);
            }
        }
        public IList<FileAttachmentModel> getAll()
        {
            Mapper.CreateMap<CRM_Attachments, FileAttachmentModel>();
            objAttachment = new CRM_AttachmentRepository();

            IList<CRM_Attachments> objEntity = objAttachment.GetAll().ToList();

            IList<FileAttachmentModel> objResult = new List<FileAttachmentModel>();

            objResult = Mapper.Map(objEntity, objResult);

            return objResult;
        }
        public IList<FileAttachmentModel> getAttachListByID(Guid attachGroupID)
        {
            objAttachment = new CRM_AttachmentRepository();

            Mapper.CreateMap<CRM_Attachments, FileAttachmentModel>();
            objAttachment = new CRM_AttachmentRepository();

            IList<CRM_Attachments> objEntity =objAttachment.GetAll(a => a.AttachGroupID == attachGroupID).ToList();

            IList<FileAttachmentModel> objResult = new List<FileAttachmentModel>();

            objResult = Mapper.Map(objEntity, objResult);

            return objResult;
        }
        public FileAttachmentModel getAttachInfoByID(Guid attachGroupID, Guid attachFileID)
        {
            objAttachment = new CRM_AttachmentRepository();

            Mapper.CreateMap<CRM_Attachments, FileAttachmentModel>();
            objAttachment = new CRM_AttachmentRepository();

            CRM_Attachments objEntity = objAttachment.GetSingle(a => a.AttachGroupID == attachGroupID && a.AttachFileID == attachFileID);

            FileAttachmentModel objResult = new FileAttachmentModel();

            objResult = Mapper.Map(objEntity, objResult);

            return objResult;
        }
        public void Save(FileAttachmentModel entity, Guid AttachGroupID, string User)
        {
            objAttachment = new CRM_AttachmentRepository();

            Mapper.CreateMap<FileAttachmentModel, CRM_Attachments>();

            CRM_Attachments objSave = new CRM_Attachments();

            objSave = Mapper.Map(entity, objSave);

            objSave.AttachGroupID = AttachGroupID;
            objSave.CreatedBy = User;
            objSave.CreatedDate = DateTime.Now;

            objAttachment.Add(objSave);
        }