private function processEndAction() { //Close the session $sessionId = $this->equipmentLogRepository->findActiveUserSession($this->user->id, $this->deviceKey); if ($sessionId !== false) { $this->equipmentLogRepository->endSession($sessionId); } else { $sessionId = $this->equipmentLogRepository->recordStartCloseExisting($this->user->id, $this->keyFob->id, $this->deviceKey, 'inaccurate start'); $this->equipmentLogRepository->endSession($sessionId); } }