code to serialize getpendingnotifications