Implemented backend logic for notifications.