private static void CallUser(int currentUserId, SchedulerEvent theEvent, int delegateId) { UserCallResults callResult = AppUser.Call(currentUserId, delegateId, theEvent.ProcessId, theEvent.ServiceId, false, Process.ProcessPromoteAction.Auto, false); var callValidStatuses = new List <UserCallResults.CallStatus>(); callValidStatuses.Add(UserCallResults.CallStatus.Success); if (!callValidStatuses.Contains(callResult.Status)) { if (callResult.Status == UserCallResults.CallStatus.LimitReached) { throw new DataException("You are serving the maximum number of cases allowed by the system."); } throw new DataException(callResult.Status.ToString()); } if (callResult.ServiceId > 0) { theEvent.ServiceId = callResult.ServiceId; } }