As per Magento standard, the second option is right to add a new record to an entity using the repository.
If you want to update exist then you have to load the record by a primary key using getById()
$slider = $this->sliderDataFactory->create()>sliderRepository->load>getById('PKID'); $this->sliderRepository->save($slider);