addImageToMediaGallery() seems to me buggy, when using
productRepository to save product, what encourage us to use deprecate method
save() directly from product model (what causes other bugs), when trying to add product programatically. What is the correct way to add image, what classes should I use in order to perform it using repository. I have added question here in comments (accepted answer seems to provide some general clues), but I think this subject deserves separte question, as stack and internet tutorials are full of deprecate code. Some real example of code would be extremely useful.
I have found an answer - it can be done using other object - example here