public function toArray($convertRecursively = true)
    {
        if ($convertRecursively) {
            // We use the json serializer as help to recursively convert the Object instances
            return json_decode(json_encode($this), true);
        } else {
            return (array) $this->data;
        }
    }