add missing import
move extraction of notification recipient further up and merge both implementation into a function