Dedicated or Shared Scrum Master

When implementing the agile way of working, companies are left with a decision on whether to have dedicated scrum master or let the role be handled by one of the existing resources in the team. I have worked in teams with both dedicated and shared resources for the scrum master role and I have formed a very clear preference.