public async Task <bool> markFinancialDischarge(string caseGuid)
        {
            try
            {
                SoapEntityRepository entityRepository = SoapEntityRepository.GetService();

                xrm.Incident entity = (xrm.Incident)entityRepository.GetEntity(xrm.Incident.EntityLogicalName, new Guid(caseGuid), new Microsoft.Xrm.Sdk.Query.ColumnSet(true));

                if (entity != null)
                {
                    if (entity.Attributes.Contains("mzk_casestatus"))
                    {
                        mzk_casestatus caseStatus = (mzk_casestatus)((OptionSetValue)entity.Attributes["mzk_casestatus"]).Value;

                        if (caseStatus != mzk_casestatus.ClinicallyDischarged)
                        {
                            throw new ValidationException("Only Clinically discharged cases can be Financially discharged");
                        }

                        entity.mzk_casestatus = new OptionSetValue((int)mzk_casestatus.FinanciallyDischarged);

                        entityRepository.UpdateEntity(entity);

                        this.createStatusLog((int)mzk_casestatus.FinanciallyDischarged, caseGuid);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(true);
        }
        public async Task <bool> markPhysicalDischarge(string caseGuid)
        {
            try
            {
                SoapEntityRepository entityRepository = SoapEntityRepository.GetService();

                xrm.Incident entity = (xrm.Incident)entityRepository.GetEntity(xrm.Incident.EntityLogicalName, new Guid(caseGuid), new Microsoft.Xrm.Sdk.Query.ColumnSet(true));

                if (entity != null)
                {
                    if (entity.Attributes.Contains("mzk_casestatus"))
                    {
                        mzk_casestatus caseStatus = (mzk_casestatus)((OptionSetValue)entity.Attributes["mzk_casestatus"]).Value;

                        if (caseStatus != mzk_casestatus.FinanciallyDischarged)
                        {
                            throw new ValidationException("Only Financially discharged cases can be Physically discharged");
                        }

                        entity.mzk_casestatus = new OptionSetValue((int)mzk_casestatus.PhysicallyDischarged);

                        entityRepository.UpdateEntity(entity);

                        this.createStatusLog((int)mzk_casestatus.PhysicallyDischarged, caseGuid);

                        if (AppSettings.GetByKey("OperationsIntegration").ToLower() == true.ToString().ToLower())
                        {
                            CaseRepository caseRepo = new CaseRepository();

                            caseRepo.updateCaseStatus(caseGuid, HMCaseStatus.PhysicalDischarge);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(true);
        }