private object ConvertToEnumerable(Type targetType, XmlRpcValue xmlRpcValue)
        {
            if (xmlRpcValue is not ArrayValue arrayValue)
            {
                throw new InvalidOperationException($"Xml rpc value must be an array value. Current type '{xmlRpcValue.GetType().Name}'");
            }

            var elementType =
                targetType.IsArray
                    ? targetType.GetElementType()
                    : targetType.IsGenericType
                        ? targetType.GetGenericArguments().First()
                        : null;

            return(CreateArray(arrayValue, elementType ?? typeof(object)));
        }
        private object ConvertToDictionary(Type targetType, XmlRpcValue xmlRpcValue)
        {
            if (xmlRpcValue is not StructValue structValue)
            {
                throw new InvalidOperationException($"Xml rpc value must be an struct value. Current type '{xmlRpcValue.GetType().Name}'");
            }

            var elementType = targetType.GetGenericArguments().Skip(1).First();

            var convertValue = GetConvertValueFunction(elementType);

            var dictionary = this.ExecuteGenericMethod <object>(nameof(ToDictionary), new [] { elementType }, structValue.Value as IDictionary, convertValue);

            return(dictionary);
        }
        private object ConvertToObject(Type targetType, XmlRpcValue xmlRpcValue)
        {
            if (xmlRpcValue is StructValue structValue)
            {
                return(CreateFromStruct(structValue, targetType));
            }

            if (targetType == typeof(object))
            {
                return(xmlRpcValue.Data);
            }

            throw new InvalidOperationException(
                      $"Xml rpc value must be an struct value or target type must be object. Current type '{xmlRpcValue.GetType().Name}'");
        }