public async Task <AccessResponse> DeleteAsync(int code) { try { var exist = await _accessRepository.FindByIdAsync(code); AccessResponse response = exist == null ? new AccessResponse($"Access {code} not found") : new AccessResponse(exist); _accessRepository.Remove(exist); await _unitOfWork.CompleteAsync(); return(response); } catch (Exception e) { return(new AccessResponse($"An error occurred when deleting the access: { e.Message }")); } }