public async Task <bool> Execute(string scopeId) { _umaServerEventSource.StartToRemoveScope(scopeId); if (string.IsNullOrWhiteSpace(scopeId)) { throw new ArgumentNullException(nameof(scopeId)); } Scope scope = null; try { scope = await _scopeRepository.Get(scopeId); } catch (Exception ex) { throw new BaseUmaException(ErrorCodes.InternalError, ErrorDescriptions.TheScopeCannotBeRetrieved, ex); } if (scope == null) { return(false); } try { await _scopeRepository.Delete(scopeId); _umaServerEventSource.FinishToRemoveScope(scopeId); return(true); } catch (Exception ex) { throw new BaseUmaException(ErrorCodes.InternalError, ErrorDescriptions.TheScopeCannotBeRemoved, ex); } }