Can we also document the header for this method? We should specify that `data` and `repository` may not be `nil`