private function castToArray($input): array
    {
        $result = array();

        foreach ($input as $key => $value) {
            $result[$key] = $this->castValue($value);
        }

        return $result;
    }