/**
  * Add a new public contact.
  *
  * @param Ticket $ticket
  * @param PublicMessageRequest $request
  * @param PublicContactRequest $contactRequest
  */
 public function addNewPublicContact(Ticket $ticket, PublicMessageRequest $request, PublicContactRequest $contactRequest)
 {
     // add a new (or update) public contact
     if ($request['public_notify'] || $request['notify']) {
         $contact = PublicContact::firstOrNew(['ticket_id' => $ticket->id, 'email' => $contactRequest['email']]);
         // create an unsubscribe slug if there isn't one
         if (is_null($contact->unsubscribe_slug)) {
             $contactRequest['unsubscribe_slug'] = rand(1000000000, 9999999999);
         }
         $contact->fill($contactRequest->all());
         $ticket->publicContacts()->save($contact);
     }
 }