def save_model(self, df, delete_old_version=True):
    incident_model_collection = self._get_incident_model_collection()
    df = df.to_dict('records')
    if (delete_old_version and (len(df) > 0)):
        model_name = df[0]['model_name']
        incident_model_collection.delete_many({'model_name': model_name})
    incident_model_collection.insert_many(df)
def save_model(self, df, delete_old_version=True):
    incident_model_collection = self._get_incident_model_collection()
    df = df.to_dict('records')
    if (delete_old_version and (len(df) > 0)):
        model_name = df[0]['model_name']
        incident_model_collection.delete_many({'model_name': model_name})
    incident_model_collection.insert_many(df)