Factorize some code for transition factories