                 log.warn "unexpected category id: #{cid}"
             else
                 o.categoryId = categoryMap[cid]
+
+        if o.operationTypeID?
+            oid = o.operationTypeID
+            if not opTypeMap[oid]?
+                log.warn "unexpected operation type id: #{oid}"
+            else
+                o.operationTypeID = opTypeMap[oid]
+
         # Strip away id
         o.id = undefined
 

                if err?
                    return h.sendErr res, "When creating category: #{err.toString()}"

                async.eachSeries all.operations, importOperation, (err) ->
                    if err?
                        return h.sendErr res, "When creating operation: #{err.toString()}"

                    async.each all.settings, importSetting, (err) ->
                        if err?
                            return h.sendErr res, "When creating setting: #{err.toString()}"

                        log.info "Import finished with success!"
                        res.sendStatus 200


        categoryMap[c.id] = nextCatId
        c.id = nextCatId++

    opTypeMap = {}
    nextOpTypeId = 0
    all.operationtypes ?= []
    for o in all.operationtypes
        opTypeMap[o.id] = nextOpTypeId
        o.id = nextOpTypeId++

    all.operations ?= []
    for o in all.operations

        if o.categoryId?
            cid = o.categoryId
            if +cid is -1
