public function setDelegate($delegate)
    {
        if (!is_object($delegate)) {
            throw new \InvalidArgumentException('Delegate needs to be an object, '.gettype($delegate).' given');
        }

        $this->__delegate = $delegate;
        return $this;
    }