public async Task <IHttpActionResult> PutUpdateSensorUser(int sensorId, int environmentId) { var userId = SecurityHelpers.ValidateToken(Request.Headers); var apiKey = await api.RegisterSensor(userId, sensorId, environmentId); return(apiKey.StartsWith("Error") ? (IHttpActionResult)BadRequest(apiKey) : Ok(apiKey)); }