/// <summary>
            /// Creates a new builder instance with pre-initialized fields from the given <see cref="IResponseAttributes"/>.
            /// </summary>
            /// <param name="responseAttributes">response attributes used for initializing this builder.</param>
            public Builder(IResponseAttributes responseAttributes)
            {
                IsCaptureEnabled        = responseAttributes.IsCapture;
                IsCrashReportingEnabled = responseAttributes.IsCaptureCrashes;
                IsErrorReportingEnabled = responseAttributes.IsCaptureErrors;
                ServerId          = responseAttributes.ServerId;
                BeaconSizeInBytes = responseAttributes.MaxBeaconSizeInBytes;
                Multiplicity      = responseAttributes.Multiplicity;

                SendIntervalInMilliseconds = responseAttributes.SendIntervalInMilliseconds;

                MaxSessionDurationInMilliseconds       = responseAttributes.MaxSessionDurationInMilliseconds;
                IsSessionSplitBySessionDurationEnabled =
                    responseAttributes.IsAttributeSet(ResponseAttribute.MAX_SESSION_DURATION);

                MaxEventsPerSession           = responseAttributes.MaxEventsPerSession;
                IsSessionSplitByEventsEnabled =
                    responseAttributes.IsAttributeSet(ResponseAttribute.MAX_EVENTS_PER_SESSION);

                SessionTimeoutInMilliseconds       = responseAttributes.SessionTimeoutInMilliseconds;
                IsSessionSplitByIdleTimeoutEnabled =
                    responseAttributes.IsAttributeSet(ResponseAttribute.SESSION_IDLE_TIMEOUT);

                VisitStoreVersion = responseAttributes.VisitStoreVersion;
            }
 private static void ApplyStatus(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.STATUS))
     {
         builder.WithStatus(attributes.Status);
     }
 }
 private static void ApplyServerId(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.SERVER_ID))
     {
         builder.WithServerId(attributes.ServerId);
     }
 }
 private static void ApplyMultiplicity(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.MULTIPLICITY))
     {
         builder.WithMultiplicity(attributes.Multiplicity);
     }
 }
 private static void ApplyApplicationId(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.APPLICATION_ID))
     {
         builder.WithApplicationId(attributes.ApplicationId);
     }
 }
 private static void ApplyTrafficControlPercentage(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.TRAFFIC_CONTROL_PERCENTAGE))
     {
         builder.WithTrafficControlPercentage(attributes.TrafficControlPercentage);
     }
 }
 private static void ApplyCaptureErrors(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.IS_CAPTURE_ERRORS))
     {
         builder.WithCaptureErrors(attributes.IsCaptureErrors);
     }
 }
 private static void ApplyBeaconSize(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.MAX_BEACON_SIZE))
     {
         builder.WithMaxBeaconSizeInBytes(attributes.MaxBeaconSizeInBytes);
     }
 }
 private static void ApplyCapture(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.IS_CAPTURE))
     {
         builder.WithCapture(attributes.IsCapture);
     }
 }
 private static void ApplyVisitStoreVersion(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.VISIT_STORE_VERSION))
     {
         builder.WithVisitStoreVersion(attributes.VisitStoreVersion);
     }
 }
 private static void ApplySendInterval(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.SEND_INTERVAL))
     {
         builder.WithSendIntervalInMilliseconds(attributes.SendIntervalInMilliseconds);
     }
 }
 private static void ApplySessionTimeout(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.SESSION_IDLE_TIMEOUT))
     {
         builder.WithSessionTimeoutInMilliseconds(attributes.SessionTimeoutInMilliseconds);
     }
 }
 private static void ApplyEventsPerSession(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.MAX_EVENTS_PER_SESSION))
     {
         builder.WithMaxEventsPerSession(attributes.MaxEventsPerSession);
     }
 }
 private static void ApplySessionDuration(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.MAX_SESSION_DURATION))
     {
         builder.WithMaxSessionDurationInMilliseconds(attributes.MaxSessionDurationInMilliseconds);
     }
 }
 private static void ApplyTimestamp(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.TIMESTAMP))
     {
         builder.WithTimestampInMilliseconds(attributes.TimestampInMilliseconds);
     }
 }
            public Builder(IResponseAttributes defaults)
            {
                SetAttributes = new HashSet <ResponseAttribute>();

                MaxBeaconSizeInBytes             = defaults.MaxBeaconSizeInBytes;
                MaxSessionDurationInMilliseconds = defaults.MaxSessionDurationInMilliseconds;
                MaxEventsPerSession          = defaults.MaxEventsPerSession;
                SessionTimeoutInMilliseconds = defaults.SessionTimeoutInMilliseconds;
                SendIntervalInMilliseconds   = defaults.SendIntervalInMilliseconds;
                VisitStoreVersion            = defaults.VisitStoreVersion;

                IsCapture                = defaults.IsCapture;
                IsCaptureCrashes         = defaults.IsCaptureCrashes;
                IsCaptureErrors          = defaults.IsCaptureErrors;
                TrafficControlPercentage = defaults.TrafficControlPercentage;
                ApplicationId            = defaults.ApplicationId;

                Multiplicity = defaults.Multiplicity;
                ServerId     = defaults.ServerId;
                Status       = defaults.Status;

                TimestampInMilliseconds = defaults.TimestampInMilliseconds;

                foreach (var attribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>())
                {
                    if (defaults.IsAttributeSet(attribute))
                    {
                        SetAttribute(attribute);
                    }
                }
            }
 private static void ApplyCaptureCrashes(Builder builder, IResponseAttributes attributes)
 {
     if (attributes.IsAttributeSet(ResponseAttribute.IS_CAPTURE_CRASHES))
     {
         builder.WithCaptureCrashes(attributes.IsCaptureCrashes);
     }
 }