async Task OnWorkstationLock(int sessionId, WorkstationEventType eventType)
        {
            if (eventType != WorkstationEventType.ComputerLock &&
                eventType != WorkstationEventType.ComputerLogoff)
            {
                return;
            }

            var we = _eventSaver.GetPrevSessionWorkstationEvent();

            we.EventId = eventType;

            lock (_lpLock)
            {
                if (_lockProcedure != null && (DateTime.UtcNow - _lockProcedure.Time).TotalSeconds <= LOCK_EVENT_TIMEOUT)
                {
                    we.Note     = _lockProcedure.Reason.ToString();
                    we.DeviceId = _bleDeviceManager.Find(_lockProcedure.Mac, 1)?.SerialNo; // Todo: Replace channel magic number with const
                }
                else
                {
                    we.Note = WorkstationLockingReason.NonHideez.ToString();
                }

                _lockProcedure = null;
            }

            await _eventSaver.AddNewAsync(we, true);
        }
        async Task OnWorkstationUnlock(int sessionId, WorkstationEventType eventType)
        {
            if (eventType != WorkstationEventType.ComputerUnlock &&
                eventType != WorkstationEventType.ComputerLogon)
            {
                return;
            }

            var time = DateTime.UtcNow;

            var procedure = _sessionUnlockMethodMonitor.UnlockProcedure;

            if (procedure != null)
            {
                WriteLine("Wait for unlock procedure");
                await procedure.Run(UNLOCK_EVENT_TIMEOUT);
            }

            WriteLine("Generating unlock event");
            var we = _eventSaver.GetWorkstationEvent();

            we.EventId = eventType;
            we.Note    = SessionSwitchSubject.NonHideez.ToString();
            we.Date    = time;

            if (procedure != null &&
                procedure.FlowUnlockResult != null &&
                procedure.FlowUnlockResult.IsSuccessful)
            {
                we.Note         = _sessionUnlockMethodMonitor.GetUnlockMethod().ToString();
                we.DeviceId     = _bleDeviceManager.Find(procedure.FlowUnlockResult.DeviceMac, 1)?.SerialNo;
                we.AccountLogin = procedure.FlowUnlockResult.AccountLogin;
                we.AccountName  = procedure.FlowUnlockResult.AccountName;
                WriteLine($"Procedure successful ({we.DeviceId}, method: {we.Note})");
            }

            //_unlockProcedure = null;

            await _eventSaver.AddNewAsync(we, true);
        }