I would just avoid anything that would require passing the $entity around between functions.