//this is fired when there is exception is raised by the service
 static void ServiceException(object sender, Exception exception)
 {
     //Do something here
     using (var context = new DBEntities())
     {
         context.ErrorLogs.Add(new ErrorLog
         {
             FormData = "",
             LoggedInDetails = "",
             QueryData = "",
             RouteData = "",
             InnerException = exception.ToString(),
             LoggedAt = DateTime.UtcNow,
             Message = exception.Message,
             StackTrace = exception.StackTrace
         });
         context.SaveChanges();
     }
 }
 //this is raised when a notification is failed due to some reason
 static void NotificationFailed(object sender, INotification notification, Exception notificationFailureException)
 {
     //Do something here
     using (var context = new DBEntities())
     {
         context.ErrorLogs.Add(new ErrorLog
         {
             FormData = "",
             LoggedInDetails = "",
             QueryData = "",
             RouteData = "",
             InnerException = notificationFailureException.GetBaseException().ToString(),
             LoggedAt = DateTime.UtcNow,
             Message = notificationFailureException.Message,
             StackTrace = notificationFailureException.StackTrace
         });
         context.SaveChanges();
     }
 }