Refactor notifications controller