Fix Neo4j query chaining by using an aggregate function in the WITH
Fix Neo4j query chaining by using an aggregate function in the WITH

Previously, subqueries would be executed once for each row in result from
the parent query. This mean that when, e.g., replacing all relationships
on a permission where we'd delete all the relationships first, the newly
added relationships would be added once per relationship that was deleted.

Using an aggregate fuction (here, `count(*)`), we ensure we only get one
result row from the parent query and thus run the subquery only once.

PicnicBasket/Eventful,PicnicBasket/Eventful