protected function createPayload()
{
if ($this->data instanceof Closure) {
$closure = serialize(new Helpers\SerializableClosure($this->data));
$data = compact('closure');
} else {
$data = $this->data;
}
return json_encode(array('id' => $this->id, 'class' => $this->class, 'data' => $data));
}