create add_all method with pattern matching