Help needed with callbacks

I’m just delving into the world of callbacks and am stuck already…

I have Article, which has_and_belongs_to_many Links (and where a link is
also an Article)

When the user tries to create a new article, i want to see if there’s
already an article with that url. If there is, i want to call a method
‘increase_points’ on the article that exists already, and not add a new
one.

In addition, if someone tries to add a link to an article, and the
article already has that link, then i want to not add the link to
article.links and return an error message.

Can anyone help me please?