[core-api] Added utility "withTransaction" methods that are useful for Java 8