lib/OktaAPIUsers.js
function mergeProfiles(what, userObj, updateProf, updateCreds, callback) {
    var finalProfile, finalCreds;
    if(updateProf != undefined) {
        finalProfile = {};
        for(prop in userObj.profile) finalProfile[prop] = userObj.profile[prop];
        for(prop in updateProf) finalProfile[prop] = updateProf[prop];
    }
    if(updateCreds != undefined) {
        finalCreds = {};
        for(prop in userObj.credentials) finalCreds[prop] = userObj.profile[prop];
        for(prop in updateCreds) finalCreds[prop] = updateCreds[prop];
    }
    what.update(userObj.id, finalProfile, finalCreds, function(d) {
        if(!d.success || d.resp.errorCode) {
            callback({success: false, error: "Failed to update user info", resp: d.resp});
            return;
        }
        callback({success: true, resp: d.resp});
    })
}
function mergeProfiles(what, userObj, updateProf, updateCreds, callback) {
    var finalProfile, finalCreds;
    if(updateProf != undefined) {
        finalProfile = {};
        for(prop in userObj.profile) finalProfile[prop] = userObj.profile[prop];
        for(prop in updateProf) finalProfile[prop] = updateProf[prop];
    }
    if(updateCreds != undefined) {
        finalCreds = {};
        for(prop in userObj.credentials) finalCreds[prop] = userObj.profile[prop];
        for(prop in updateCreds) finalCreds[prop] = updateCreds[prop];
    }
    what.update(userObj.id, finalProfile, finalCreds, function(d) {
        if(!d.success || d.resp.errorCode) {
            callback({success: false, error: "Failed to update user info", resp: d.resp});
            return;
        }
        callback({success: true, resp: d.resp});
    })
}
*****************************************************************
************** Users->Credential Operations End *******************
*******************************************************************
 /*
Private methods, merge two profiles