START n=node:stylesheetid(stylesheetid={0}) MATCH n-[rels*1..]->p WITH n, rels, p, collect(p.availableImages) as photosid
FOREACH(rel IN rels: DELETE rel) DELETE p
WITH n, photosid MATCH n<-[r]-() DELETE n, r
RETURN DISTINCT photosid
--