Remove duplicate map table if it exists

def deleteMapTable(self, name, session):
        """
        Remove duplicate map table if it exists
        """

        duplicate_map_tables = session.query(MapTable).filter(MapTable.mapTableFile == self).filter(MapTable.name == name).all()
        for duplicate_map_table in duplicate_map_tables:
            if duplicate_map_table.indexMap:
                session.delete(duplicate_map_table.indexMap)
            session.delete(duplicate_map_table)
            session.commit()