internal unsafe static CefValue CastCefV8ValueToCefValue(CefV8Context context, CefV8Value value, out bool isXray)
        {
            isXray = false;
            if (value == null)
            {
                return(null);
            }

            if (!value.IsValid)
            {
                throw new InvalidCastException();
            }

            CefValue v;

            switch (value.Type)
            {
            case CefV8ValueType.Undefined:
                v = new CefValue();
                v.SetBinary(new byte[1]);
                return(v);

            case CefV8ValueType.Null:
                v = new CefValue();
                v.SetNull();
                return(v);

            case CefV8ValueType.Bool:
                v = new CefValue();
                v.SetBool(value.GetBoolValue());
                return(v);

            case CefV8ValueType.Int:                     // TYPE_INT, TYPE_UINT
            case CefV8ValueType.UInt:
                v = new CefValue();
                v.SetInt(value.GetIntValue());
                return(v);

            case CefV8ValueType.Double:
                v = new CefValue();
                v.SetDouble(value.GetDoubleValue());
                return(v);

            case CefV8ValueType.Date:
                v = new CefValue();
                v.SetBinary(XrayHandle.FromDateTime(value.GetDateValue().ToDateTime()).ToCfxBinaryValue());
                return(v);

            case CefV8ValueType.String:
                v = new CefValue();
                if (!value.CopyV8StringToCefValue(v))
                {
                    throw new CefRuntimeException("Can't copy the string.");
                }
                return(v);

            case CefV8ValueType.Object:
                isXray = true;
                if (value.IsArray)                         //TYPE_OBJECT (array)
                {
                    throw new NotImplementedException();
                }
                if (value.IsArrayBuffer)                         //TYPE_OBJECT (arraybuffer)
                {
                    throw new NotImplementedException();
                }
                v = new CefValue();
                v.SetBinary(XrayObject.Wrap(context, value).CreateHandle().ToCfxBinaryValue());
                return(v);
            }
            throw new NotImplementedException();
        }