Return Collection instance instead of array in flatten method