public TodoList SaveNew(TodoList todolist)

        {
            using (NpgsqlConnection connection = DatabaseService.CreateConnection())
            {
                connection.Open();
                using (NpgsqlCommand cmd = new NpgsqlCommand(
                           "insert into schedules (name, description) values(@name, @description) returning id", connection))
                {
                    cmd.Parameters.AddWithValue("name", todolist.GetName());
                    cmd.Parameters.AddWithValue("description", todolist.GetDescription());
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            todolist.SetId(reader.GetInt32(0));
                        }
                    }
                }
            }
            return(todolist);
        }
        public void UpdateTodoListById(int id, [FromBody] TodoListDto dto)
        {
            TodoList todoList = todoListMapper.MapToObject(dto);

            todoListRepository.Update(todoList);
        }
        public TodoListDto GetTodoListById(int id)
        {
            TodoList todoList = todoListRepository.GetById(id);

            return(todoListMapper.MapToDto(todoList));
        }