public async Task UpdateTodoAsync(UpdatedTodoDTO updatedTodoDTO) { var todoToUpdate = _mapper.Map <UpdatedTodoDTO, Todo>(updatedTodoDTO); try { await _todosRepository.UpdateTodoAsync(todoToUpdate); } catch (RecordNotFoundException) { throw new TodoNotFoundException(); } catch (ConcurrentAccessException) { // TODO: Add logging here to indicate that we have hit // a database concurrency issue. For now I'll just // throw a NotFound error if the todo does not actually exist. // If it does exist, for now I'll just rethrow the error. bool todoExists = await _todosRepository.Exists(updatedTodoDTO.Id.Value); if (!todoExists) { throw new TodoNotFoundException(); } throw; } }