protected function validateSet($key, $value)
    {
        $maxItems = $this->getMaxItems();
        if ((is_null($key) || !array_key_exists($key, $this->items)) && $maxItems != 0 && $this->count() >= $maxItems) {
            throw new ItemCountException('The maximum number of items has been reached on this field.');
        }

        if (is_null($key) && is_null($value)) {
            throw new NullValueException('You cannot add a null value');
        }
    }