public bool PatientToDoExists(PlanElementEventArg arg, string sourceId) { try { var todos = EndpointUtil.GetPatientToDos(arg.PatientId, arg.UserId, arg.DomainRequest); if (todos == null) { return(false); } var existing = todos.FirstOrDefault(r => r.SourceId == sourceId && (r.StatusId == 1 || r.StatusId == 3)); // open = 1, NotMet = 3 status if (existing == null) { return(false); } return(true); } catch (Exception ex) { throw new Exception("AD:ToDoActivationRule:PatientToDoExists()::" + ex.Message, ex.InnerException); } }