What does CleanPrivateRelations do?

What is the purpose of the function cleanPrivateRelations method in the javascript generated model code.

cleanPrivateRelations(data) {
    function isObject(obj) {
        return obj !== null && typeof obj === 'object';
    }


    if (data.hasOwnProperty('_private_relations') && data['_private_relations'].length > 0) {
        data['_private_relations'].forEach(function(relation) {
            if (data.hasOwnProperty(relation) && isObject(data[relation])) {
                if (Array.isArray(data[relation])) {
                    data[relation].forEach(function(elem) {
                        if (isObject(elem)) {
                            cleanPrivateRelations(elem);
                        }
                    });
                } else {
                    cleanPrivateRelations(data[relation]);
                }
            }
        });
    }


    if (isObject(data)) {
        delete data['_private_relations'];
        delete data['_private_geoRelations'];
        delete data['_private_dates'];
    }
}

This is an internal cleanup routine. Is there any particular reason you are asking other than curiosity?

I am using the generate code for defining my models in javascript. I see you are stripping out the fields that do not need to be sent to save the object.

Please clarify - does the method cause a problem for your app/implementation?

This method is not causing problems. I just wanted to understand what it was doing and if I should incorporate the method into my javascript app.