public TypeConsultationRecipientItem InsertRecipient(TypeConsultationRecipientItem item)
        {
            try
            {
                TmpTypeConsultationRecipient entity = new TmpTypeConsultationRecipient
                {
                    TypeConsultationRecipientID = 0,
                    TypeConsultationID          = item.TypeConsultationID,
                    OrganizationID = item.OrganizationID,
                    RecipientDate  = item.RecipientDate,
                    GUID           = item.GUID
                };

                db.TmpTypeConsultationRecipients.Add(entity);

                db.SaveChanges();

                item.ID = entity.ID;
                item.TypeConsultationRecipientID = entity.TypeConsultationRecipientID;
                Organization organization = db.Organizations.Find(item.OrganizationID);
                item.OrganizationName = organization.OrganizationName;

                return(item);
            }
            catch (Exception ex)
            {
                exception = ex;
                return(null);
            }
        }
        public TypeConsultationRecipientItem UpdateRecipient(TypeConsultationRecipientItem item)
        {
            try
            {
                TmpTypeConsultationRecipient entity = new TmpTypeConsultationRecipient
                {
                    ID = item.ID,
                    TypeConsultationRecipientID = item.TypeConsultationRecipientID,
                    TypeConsultationID          = item.TypeConsultationID,
                    OrganizationID = item.OrganizationID,
                    RecipientDate  = item.RecipientDate,
                    GUID           = item.GUID
                };

                db.TmpTypeConsultationRecipients.Attach(entity);
                db.Entry(entity).State = EntityState.Modified;

                db.SaveChanges();

                Organization organization = db.Organizations.Find(item.OrganizationID);
                item.OrganizationName = organization.OrganizationName;
                return(item);
            }
            catch (Exception ex)
            {
                exception = ex;
                return(null);
            }
        }
        public TypeConsultationRecipientItem DeleteRecipient(TypeConsultationRecipientItem item)
        {
            try
            {
                TmpTypeConsultationRecipient entity = new TmpTypeConsultationRecipient
                {
                    ID = item.ID,
                    TypeConsultationRecipientID = item.TypeConsultationRecipientID,
                    TypeConsultationID          = item.TypeConsultationID,
                    OrganizationID = item.OrganizationID,
                    RecipientDate  = item.RecipientDate,
                    GUID           = item.GUID
                };

                db.TmpTypeConsultationRecipients.Attach(entity);
                db.TmpTypeConsultationRecipients.Remove(entity);

                db.SaveChanges();
                return(item);
            }
            catch (Exception ex)
            {
                exception = ex;
                return(null);
            }
        }