public async Task <IActionResult> AddHeartbeat([FromBody] HeartbeatViewModel request, string agentId) { try { var newHeartBeat = _agentManager.PerformAgentHeartbeat(request, agentId); var resultRoute = "GetAgentHeartbeat"; CreatedAtRoute(resultRoute, new { id = newHeartBeat.Id.Value.ToString("b") }, newHeartBeat); if (request.GetNextJob) { var nextJob = _agentManager.GetNextJob(agentId); return(Ok(nextJob)); } return(Ok()); } catch (Exception ex) { return(ex.GetActionResult()); } }