public function validateElement($element)
    {
        if (!is_object($element)) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid element of type %s passed to %s, expected: %s',
                gettype($element),
                get_class($this),
                $this->getClass()
            ));
        }

        if (!is_a($element, $this->getClass())) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid element (instance of %s) passed to %s, expected: %s',
                get_class($element),
                get_class($this),
                $this->getClass()
            ));
        }
    }