public void StartRecording(Protocol protocol)
        {
            _recordStarted = true;
            try
            {
                StartRecordingParamsBuilder _startRecordingPB = new StartRecordingParamsBuilder();
                if (_userPathName != null && _userPathName.Length != 0)
                {
                    ContainsUserPathParamsBuilder _containsBuilder = new ContainsUserPathParamsBuilder();
                    _containsBuilder.name(_userPathName);
                    _userPathExist = _client.ContainsUserPath(_containsBuilder.Build());
                    if (_userPathExist)
                    {
                        _startRecordingPB.virtualUser(_userPathName + "_recording");
                    }
                    else
                    {
                        _startRecordingPB.virtualUser(_userPathName);
                    }
                }
                if (Protocol.SAP.Equals(protocol))
                {
                    _startRecordingPB.isSapGuiProtocol(true);
                    _startRecordingPB.isCreateTransactionBySapTCode(_createTransactionBySapTCode);
                }
                else if (Protocol.WEB.Equals(protocol))
                {
                    _startRecordingPB.isHTTP2Protocol(_http2);
                    if (_systemProxyHelper == null)
                    {
                        _systemProxyHelper = new SystemProxyHelper(_apiPort);
                        _systemProxyHelper.setProxy(_apiHost, _recorderProxyPort, "");
                    }
                }

                _client.StartRecording(_startRecordingPB.Build());
            } catch (Exception e)
            {
                _recordStarted     = false;
                _instance          = null;
                _systemProxyHelper = null;
                WriteExceptionToFile(e);
                throw e;
            }

            try
            {
                NeoloadRestApiInstance.GetInstance().SendUsageEvent("recording", protocol);
            } catch (Exception e)
            {
                // Do nothing if send event fails
            }
        }
 private void HandleUserPathName(StartRecordingParamsBuilder startRecordingPB)
 {
     if (_userPathName != null && _userPathName.Length != 0)
     {
         if (_updateUserPath)
         {
             ContainsUserPathParamsBuilder _containsBuilder = new ContainsUserPathParamsBuilder();
             _containsBuilder.name(_userPathName);
             _userPathExist = _client.ContainsUserPath(_containsBuilder.Build());
             if (_userPathExist)
             {
                 startRecordingPB.virtualUser(_userPathName + "_recording");
             }
             else
             {
                 startRecordingPB.virtualUser(_userPathName);
             }
         }
         else
         {
             startRecordingPB.virtualUser(_userPathName);
         }
     }
 }