factoryized the removeContact function in TodoController