public SendGridBinding(ParameterInfo parameter, SendGridAttribute attribute, SendGridConfiguration config, BindingProviderContext context)
            {
                _parameter = parameter;
                _attribute = attribute;
                _config = config;

                _sendGrid = new Web(_config.ApiKey);

                if (!string.IsNullOrEmpty(_attribute.To))
                {
                    _toFieldBinding = new BindablePath(_attribute.To);
                    _toFieldBinding.ValidateContractCompatibility(context.BindingDataContract);
                }

                if (!string.IsNullOrEmpty(_attribute.Subject))
                {
                    _subjectFieldBinding = new BindablePath(_attribute.Subject);
                    _subjectFieldBinding.ValidateContractCompatibility(context.BindingDataContract);
                }

                if (!string.IsNullOrEmpty(_attribute.Text))
                {
                    _textFieldBinding = new BindablePath(_attribute.Text);
                    _textFieldBinding.ValidateContractCompatibility(context.BindingDataContract);
                }
            }
        private static bool CanBind(BindingProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            // first, verify the file path binding (if it contains binding parameters)
            ParameterInfo parameter = context.Parameter;
            FileAttribute attribute = parameter.GetCustomAttribute<FileAttribute>(inherit: false);
            BindablePath path = new BindablePath(attribute.Path);
            path.ValidateContractCompatibility(context.BindingDataContract);

            // next, verify that the type is one of the types we support
            IEnumerable<Type> types = StreamValueBinder.SupportedTypes.Union(new Type[] { typeof(FileStream) });
            return ValueBinder.MatchParameterType(parameter, types);
        }