public void ProcessJob() { using (var dataContext = new HuntingEntities()) { var emailList = EmailContext.GetSendList(dataContext); if (emailList != null) { foreach (var emailInfo in emailList) { string errorMessage; var isSuccess = SendEmail(dataContext, emailInfo, out errorMessage); if (isSuccess) { EmailContext.ProcessSuccess(dataContext, emailInfo); } else { EmailContext.ProcessFailure(dataContext, emailInfo, errorMessage); } } } } }