Concentrate fn:doc usage and get $collection content, get $currentResource and get $externalResource into one single doc retrieving function