private bool IsMethodAnonymous(HealthVaultMethods method)
        {
            if (_anonymousMethodSet.Contains(method))
            {
                return(true);
            }

            var type   = method.GetType().GetTypeInfo();
            var member = type.GetDeclaredField(method.ToString());

            if (member.GetCustomAttribute <AnonymousMethodAttribute>() != null)
            {
                _anonymousMethodSet.Add(method);
                return(true);
            }

            return(false);
        }
        public void SetRequestHeader(
            HealthVaultMethods method,
            int methodVersion,
            bool isAnonymous,
            Guid?recordId,
            Guid?appId,
            string infoXml,
            Request request)
        {
            request.Header = new RequestHeader
            {
                Method        = method.ToString(),
                MethodVersion = methodVersion
            };

            if (recordId != null)
            {
                request.Header.RecordId = recordId.Value.ToString();
            }

            // in case the method is anonymous - set app id, else set auth session
            if (isAnonymous)
            {
                request.Header.AppId = appId.HasValue
                    ? appId.Value.ToString()
                    : _healthVaultConfiguration.MasterApplicationId.ToString();
            }
            else
            {
                request.Header.AuthSession = _connectionInternal.GetAuthSessionHeader();
            }

            request.Header.MessageTime = SDKHelper.XmlFromNow();
            request.Header.MessageTtl  = (int)_healthVaultConfiguration.RequestTimeToLiveDuration.TotalSeconds;

            request.Header.Version =
                $"{_telemetryInformation.Category}/{_telemetryInformation.FileVersion} {_telemetryInformation.OsInformation}";

            request.Header.InfoHash = new InfoHash
            {
                HashData = _cryptographer.Hash(Encoding.UTF8.GetBytes(infoXml))
            };
        }