Currently, the method CModelsInterface.insert_one_cmodel_document is not only inserting but updating the documents where necessary. Split this two functionalities and, if necessary, create a new one that inserts or updates accordingly.
The same method in question is not returning consistent type of objects e.g. when it does not insert a document because it exists exactly as it was pretended to be inserted, it returns the document to be inserted; when it updates the model because it existed but the newer document has updated information, it returns a bool and when it inserts a model that didn't exist, it returns the inserted model.
CModelsInterface.insert_one_cmodel_document
is not only inserting but updating the documents where necessary. Split this two functionalities and, if necessary, create a new one that inserts or updates accordingly.