       result = []
     result
 
-  getDiffRoles = (aInstance, ctx)->
-    if ctx.instance # full save of a single model
-      vAddedRoles = aInstance[rolesFieldName]
-    else # if ctx.data # Partial update of possibly multiple models
-      unless ctx.currentInstance # The Role only
-        err = new Error
-        err.statusCode = 401
-        err.message = 'Disable batch update roles'
-        err.code = 'NO_AUTHORITY_BATCH_ROLE'
-        throw err
+  getDiffRoles = (aNewRoles, aOriginalRoles)->
+    if aOriginalRoles and aOriginalRoles.length
       vAddedRoles = []
       vDelRoles = []
-      vOrgionalRoles = ctx.currentInstance[rolesFieldName]
-      if vOrgionalRoles and vOrgionalRoles.length
-        vNewRoles = aInstance[rolesFieldName]
-        for i in vNewRoles
-          vAddedRoles.push i if vOrgionalRoles.indexOf(i) is -1
-        for i in vOrgionalRoles
-          vDelRoles.push i if vNewRoles.indexOf(i) is -1
-      else
-        vAddedRoles = aInstance[rolesFieldName]
+      for i in aNewRoles
+        vAddedRoles.push i if aOriginalRoles.indexOf(i) is -1
+      for i in aOriginalRoles
+        vDelRoles.push i if aNewRoles.indexOf(i) is -1
+    else
+      vAddedRoles = aNewRoles
+
     [getValidRoles(vAddedRoles), getValidRoles(vDelRoles)]
 
   indexOfRef = (aRefs, aModel, aId)->

    else # if ctx.data # Partial update of possibly multiple models
      delete vInstance[permsFieldName]

    return Promise.resolve() unless vInstance[rolesFieldName]?
    vInstance[rolesFieldName] = getValidRoles vInstance[rolesFieldName]
    calcPerms vInstance, ctx
    .then (aPerms)->
      vInstance[permsFieldName] = aPerms
      ctx.options = {} unless ctx.options
      ctx.options.updatePermsByRefs = 0

  Model.observe 'after save',(ctx)->
    return Promise.resolve() if ctx.options and ctx.options.skipPropertyFilter

    vInstance = ctx.instance || ctx.data
    return Promise.resolve() unless vInstance and vInstance[rolesFieldName]?
    addToRefs(vInstance, ctx)

    -1

  addToRefs = (aInstance, ctx)->
    [vAddedRoles, vDelRoles] = getDiffRoles aInstance[rolesFieldName], ctx.hookState.oldRoles

    vId = aInstance.id

