@staticmethod
def ensure_piece(piece_path, piece_name, conn, cursor):
    """
        Ensure the given piece is included
            :param piece_path: Path to the piece
            :param piece_name: Name of the piece
            :param conn: Connection to sqlite instance
            :param cursor: Cursor to use
        """
    cursor.execute('SELECT id FROM pieces WHERE path=? AND name=? LIMIT 1',
        (piece_path, piece_name))
    results = cursor.fetchall()
    if results:
        return results[0][0]
    cursor.execute('INSERT INTO pieces (path, name) VALUES (?, ?)', (
        piece_path, piece_name))
    conn.commit()
    return cursor.lastrowid
