def insert_pattern(pattern, model, index=0):
        """
        Inserts given pattern into given Model.

        :param pattern: Pattern.
        :type pattern: unicode
        :param model: Model.
        :type model: PatternsModel
        :param index: Insertion indes.
        :type index: int
        :return: Method success.
        :rtype: bool
        """

        if not pattern:
            return False

        pattern = pattern.replace(QChar(QChar.ParagraphSeparator), QString("\n"))
        pattern = foundations.common.get_first_item(foundations.strings.to_string(pattern).split("\n"))

        model.insert_pattern(foundations.strings.to_string(pattern), index)

        return True