protected function convertToArray($data, Closure $callback)
    {
        if (is_null($data)) {
            return array();
        }

        if ($data instanceof Traversable) {
            return iterator_to_array($data);
        }

        if (self::isStringable($data)) {
            $data = (string) $data;
            $data = trim($data);
            $data = $callback($data);
        }

        if (! is_array($data)) {
            throw new RuntimeException('Your submitted data could not be converted into a proper array');
        }

        return $data;
    }