Added toArray() and toJSON() methods on models