Implemented mailer when invitation is used

  and refactored controllers