Fixing issue in `toJSONObject` function of `Schedule` class.

The issue: TimeRanges is null. This might happen if Schedule was constructed with
```c#
public Schedule(int activationLimit) :
```
In which case `TimeRanges` will be null.