<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def insert_pattern(self, pattern, index):
 """ Inserts given pattern into the Model. :param pattern: Pattern. :type pattern: unicode :param index: Insertion index. :type index: int :return: Method success. :rtype: bool """


        LOGGER.debug("> Inserting '{0}' at '{1}' index.".format(pattern, index))

        self.remove_pattern(pattern)

        self.beginInsertRows(self.get_node_index(self.root_node), index, index)
        pattern_node = PatternNode(name=pattern)
        self.root_node.insert_child(pattern_node, index)
        self.endInsertRows()
        self.pattern_inserted.emit(pattern_node)
        return True