public function getField($name)
    {
        if (isset($this->fields[$name])) {
            return $this->fields[$name];
        } else {
            throw new \InvalidArgumentException('Field with name '.$name.' not found');
        }
    }