public async Task <IActionResult> ArmLocation([FromBody] LocationViewModel locationViewModel) { try { var location = await _locationRepository.GetLocationById(locationViewModel.Id); var user = await GetUser(); await _locationRepository.ValidateLocationForUser(user, location); if (locationViewModel.Armed) { await _locationRepository.ArmLocation(location, user, _locationActionEventsRepository); } else { await _locationRepository.DisarmLocation(location, user, _locationActionEventsRepository); } return(Ok(location)); } catch (Exception ex) { Logger.LogError(ex.Message); return(BadRequest(new ErrorResponse(ex))); } }