How to teach your dog to not bark at the wrong times

Every dog thats ever lived has barked. And some people dont like it. Especially when its loud and "unnecessary" barking. My own take on