LPS-51565 Simplify and if treePath is null, we should fall back to the "slower" way of getting the ancestor ids, not return null.
LPS-51565 Fields should be deleted in reverse order (opposite of creation order) to avoid parent/child dependency deletion restrictions.