Prevents Error "Converting circular structure to JSON" while sending models to socket

In some cases a model can have a circular structure through associations.