[#4994] Improved error checking around notifications to prevent lost notifications

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>
[#4994] Fixed bug in direct notification accumulation that could cause missing notifications

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>
[#4994] Added more logging when sending notifications for debugging

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>
[#4994] Fixed race condition when posting notifications

If the thread that posts the notification takes a while to flush the
session (most easily seen on repo refreshes), then the Task can get
started before the new Notification instance is saved to mongo

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>