public DeletePatientProgramByPatientIdDataResponse DeletePatientProgramByPatientId(DeletePatientProgramByPatientIdDataRequest request)
        {
            DeletePatientProgramByPatientIdDataResponse response = null;
            bool success = false;

            try
            {
                response = new DeletePatientProgramByPatientIdDataResponse();
                IProgramRepository ppRepo = Factory.GetRepository(request, RepositoryType.PatientProgram);

                List <MEPatientProgram>      meppList = ppRepo.FindByPatientId(request.PatientId) as List <MEPatientProgram>;
                List <DeletedPatientProgram> deletedPatientPrograms = null;

                if (meppList != null && meppList.Count > 0)
                {
                    deletedPatientPrograms = new List <DeletedPatientProgram>();
                    meppList.ForEach(mePP =>
                    {
                        DeletePatientProgramDataRequest req = new DeletePatientProgramDataRequest {
                            Context        = request.Context,
                            ContractNumber = request.ContractNumber,
                            UserId         = request.UserId,
                            Version        = request.Version
                        };
                        DeletedPatientProgram deletedPatientProgram = null;
                        if (delete(mePP, req, ppRepo, out deletedPatientProgram))
                        {
                            deletedPatientPrograms.Add(deletedPatientProgram);
                            success = true;
                        }
                    });
                    response.DeletedPatientPrograms = deletedPatientPrograms;
                }
                else
                {
                    success = true;
                }
                response.Success = success;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }