Remove some code duplication in our ShareHandler.