Fix asArray method in api for nested models and collections