Fixed a scope issue with the toObject method when printing all enumerable properties

Replaces this[attr] with self[attr] in toObject for enumerable properties inside of the model.js library.