Fix to object conversion on after sortBy

After sortBy is called on a collection it is no longer an array but an object when the collection is outputted with toJson(). This makes sure it is still sorted, but it remains an array.

Before sortBy:
```javascript
[
   {
      "id":2,
      "username":"user2"
   },
   {
      "id":3,
      "username":"user3"
   }
]
```

After sortyBy, toJson outputs:
```javascript
{
   "1":{
      "id":2,
      "username":"user2"
   },
   "0":{
      "id":3,
      "username":"user3"
   }
}
```
With this change:
```javascript
[
   {
      "id":3,
      "username":"user3"
   },
   {
      "id":2,
      "username":"user2"
   }
]
```