Stored procedure example / repo

I like to have a 'created' and 'modified' field on nodes and relationships, I was thinking of automatically adding them on the frontend but it fits better doing this server side.

Is there not a better more fitting example than this. Or maybe there is some sort of repo. I can't imagine I am the first that would like to add fields (and even default relationships)

I found this, but it generates errors

CALL apoc.trigger.add(
  'setCreatedProperty',
  'UNWIND $createdNodes AS n SET n.created = timestamp()',
  {phase: "after"}
)

Error executing trigger setCreatedProperty in phase after
org.neo4j.kernel.DeadlockDetectedException: ForsetiClient[transactionId=59, clientId=3] can't acquire ExclusiveLock{owner=ForsetiClient[transactionId=58, clientId=2]} on NODE_RELATIONSHIP_GROUP_DELETE(53), because we are waiting for ForsetiClient[transactionId=58, clientId=2] that is committing on the same thread

Working now with this

CALL apoc.trigger.add(
  'setCreatedProperty',
  'UNWIND $createdNodes AS n SET n.created = timestamp()',
  {phase: "afterAsync"}
)

but not so nice it is not straight away available in the result