diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/flow.py b/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/flow.py
index 40f7509e0fe25b91b8927c38bbc36ddd3792dc46..5e1141655e9c4afd513627ce7acca60c36211774 100644
--- a/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/flow.py
+++ b/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/flow.py
@@ -1,19 +1,7 @@
-from ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search import DataSetSearchCriteria
-from ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions import DataSetFetchOptions
-
 import script
 
 def addSampleChildNodes(path, samplePermId, sampleType, response, acceptor, context):
-    dataSetSearchCriteria = DataSetSearchCriteria()
-    dataSetSearchCriteria.withOrOperator()
-    dataSetSearchCriteria.withSample().withPermId().thatEquals(samplePermId)
-    parentsSearchCriteria = dataSetSearchCriteria.withSample().withParents()
-    parentsSearchCriteria.withPermId().thatEquals(samplePermId)
-    fetchOptions = DataSetFetchOptions()
-    fetchOptions.withType()
-    fetchOptions.withProperties()
-    fetchOptions.withSample()
-    dataSets = context.getApi().searchDataSets(context.getSessionToken(), dataSetSearchCriteria, fetchOptions).getObjects()
+    dataSets = script.getDataSetsOfSampleAndItsChildren(samplePermId, context)
     for dataSet in dataSets:
         if acceptor.acceptDataSet(dataSet):
             dataSetCode = dataSet.getCode()
@@ -22,16 +10,7 @@ def addSampleChildNodes(path, samplePermId, sampleType, response, acceptor, cont
             script.addDataSetFileNodes(path, dataSetCode, contentNode, response, acceptor, context)
 
 def addSampleChildNodesWithPlates(path, samplePermId, sampleType, response, acceptor, context):
-    dataSetSearchCriteria = DataSetSearchCriteria()
-    dataSetSearchCriteria.withOrOperator()
-    dataSetSearchCriteria.withSample().withPermId().thatEquals(samplePermId)
-    parentsSearchCriteria = dataSetSearchCriteria.withSample().withParents()
-    parentsSearchCriteria.withPermId().thatEquals(samplePermId)
-    fetchOptions = DataSetFetchOptions()
-    fetchOptions.withType()
-    fetchOptions.withProperties()
-    fetchOptions.withSample().withType()
-    dataSets = context.getApi().searchDataSets(context.getSessionToken(), dataSetSearchCriteria, fetchOptions).getObjects()
+    dataSets = script.getDataSetsOfSampleAndItsChildren(samplePermId, context)
     for dataSet in dataSets:
         sampleTypeCode = dataSet.getSample().getType().getCode()
         if not sampleTypeCode.endswith("_WELL"):
diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/microscopy.py b/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/microscopy.py
index 68885e4499b13be33d80e6cbb035371aa2339aa3..7429a9d6a6d34a90f0aff9aee79bca0a83e502e1 100644
--- a/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/microscopy.py
+++ b/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/resolver-plugins/microscopy.py
@@ -1,6 +1,3 @@
-from ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.search import DataSetSearchCriteria
-from ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.fetchoptions import DataSetFetchOptions
-
 import script
 
 acceptor.hideDataSetType("MICROSCOPY_IMG_CONTAINER")
@@ -9,16 +6,7 @@ acceptor.hideDataSetType("MICROSCOPY_IMG_THUMBNAIL")
 #acceptor.hideSampleType("MICROSCOPY_SAMPLE_TYPE")
 
 def addSampleChildNodes(path, samplePermId, sampleType, response, acceptor, context):
-    dataSetSearchCriteria = DataSetSearchCriteria()
-    dataSetSearchCriteria.withOrOperator()
-    dataSetSearchCriteria.withSample().withPermId().thatEquals(samplePermId)
-    parentsSearchCriteria = dataSetSearchCriteria.withSample().withParents()
-    parentsSearchCriteria.withPermId().thatEquals(samplePermId)
-    fetchOptions = DataSetFetchOptions()
-    fetchOptions.withType()
-    fetchOptions.withProperties()
-    fetchOptions.withSample()
-    dataSets = context.getApi().searchDataSets(context.getSessionToken(), dataSetSearchCriteria, fetchOptions).getObjects()
+    dataSets = script.getDataSetsOfSampleAndItsChildren(samplePermId, context)
     for dataSet in dataSets:
         if acceptor.acceptDataSet(dataSet):
             dataSetCode = dataSet.getCode()
diff --git a/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/script.py b/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/script.py
index 8909b6834b1ed9594bcf7ce7e3563673100fe67f..37f6c5a87373436450acf9211313bae67610cb2c 100644
--- a/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/script.py
+++ b/ui-eln-lims/src/core-plugins/eln-lims/1/dss/file-system-plugins/eln-tree/script.py
@@ -359,6 +359,18 @@ def getContentNode(permId, context):
     contentNode = content.tryGetNode(splittedId[1]) if len(splittedId) > 1 else content.getRootNode()
     return dataSetCode, contentNode, content
 
+def getDataSetsOfSampleAndItsChildren(samplePermId, context):
+    dataSetSearchCriteria = DataSetSearchCriteria()
+    dataSetSearchCriteria.withOrOperator()
+    dataSetSearchCriteria.withSample().withPermId().thatEquals(samplePermId)
+    parentsSearchCriteria = dataSetSearchCriteria.withSample().withParents()
+    parentsSearchCriteria.withPermId().thatEquals(samplePermId)
+    fetchOptions = DataSetFetchOptions()
+    fetchOptions.withType()
+    fetchOptions.withProperties()
+    fetchOptions.withSample().withType()
+    return context.getApi().searchDataSets(context.getSessionToken(), dataSetSearchCriteria, fetchOptions).getObjects()
+
 def listDataSets(path, dataSetSearchCriteria, assignedToSample, response, acceptor, context):
     fetchOptions = DataSetFetchOptions()
     fetchOptions.withType()