If we have org file with datetree and repeating actions, how can I capture under last heading of some level. Let's say we have this:
* 2018
** 2018-W47
*** 2018-11-21 Wednesday
**** Gym Session
** 2018-W48
*** 2018-12-01 Saturday
**** Running
*** 2018-12-02 Sunday
**** Gym Session
I want to create org-capture template which would put entry under last "Gym Session" from Sunday. This means I can't use heading, because it's not guaranteed to be unique. Is there some function like "org-last-heading-of-level-4" or something similar maybe? Thanks!