code: function(instance, opt){
        if(instance.context && instance.context.diffs && instance.context.diffs.length > 0){
           var Revision = sequelize.model(options.revisionModel);
           var RevisionChange = sequelize.model(options.revisionChangeModel);
           var diffs = instance.context.diffs;
           var previousVersion = instance._previousDataValues;
           var currentVersion = instance.dataValues;
  
           var user = opt.user;
           if(!user && instance.context && instance.context.user){
              user = instance.context.user;
           }
  
           // Build revision
           var revision = Revision.build({
              model: opt.model.name,
              documentId: instance.get("id"),
              revision: instance.get(options.revisionAttribute),
              // Hacky, but necessary to get immutable current representation
              document: JSON.parse(JSON.stringify(currentVersion)),
              // Get user from instance.context, hacky workaround, any better idea?
              userId: options.userModel && user ? user.id : null
           });
  
           // Save revision
           revision.save().then(function(revision){
              // Loop diffs and create a revision-diff for each
              diffs.forEach(function(difference){
                 var o = convertToString(difference.item ? difference.item.lhs : difference.lhs);
                 var n = convertToString(difference.item ? difference.item.rhs : difference.rhs);
                 var d = RevisionChange.build({
                    path: difference.path[0],
                    document: difference,
                    //revisionId: data.id,
                    diff: o || n ? jsdiff.diffChars(o, n) : []
                 });
                 d.save().then(function(d){
                    // Add diff to revision
                    revision.addChange(d);
                 }).catch(log);
              });
           }).catch(log);
        }
     }
docs: After create/update store diffs