def METHOD_NAME(coll, activities, sequenceId, parent = None):
  for activity in activities:
    updateProps =  {"$set": {"sequenceId": sequenceId, "startDate": activity["startDate"], "endDate": activity["endDate"] }, "$unset": {"parents": ""}}
    if parent:
      updateProps["$set"]["parent"] = uuid.UUID(parent)
    query = {"_id": uuid.UUID(activity["id"])}
    currentActivity = coll.find_one(query, {"resources": 1, "data":1})
    if "resources" in currentActivity and type(currentActivity["resources"]) is list:
      updateProps["$set"]["resources"] = { "shared_id": currentActivity["resources"] }
    if "data" in currentActivity and type(currentActivity["data"]) is dict:
      updateProps["$set"]["data"] = migrateData(currentActivity["data"])
    coll.update_one(query, updateProps)
    if "subTasks" in activity:
      METHOD_NAME(coll, activity["subTasks"], sequenceId, activity["id"])