managing collections and toJSON methods for save operation