protected function iterate($value, PropertyDefinitionInterface $definition = null)
    {
        if (empty($value) || !is_array($value)) {
            return $value;
        }

        $type = $definition->getGenericType();

        foreach ($value as $key => $item) {
            if (is_null($item)) {
                continue;
            }

            $value[$key] = $this->castValue($item, $type);
        }

        return $value;
    }