public function beforeSave(Event $event, Entity $entity, ArrayObject $options)
    {
        if (empty($entity->expiry)) {
            $entity->expiry = Configure::read('Tokens.expiryDefaultValue');
        }

        if (!empty($entity->extra)) {
            $entity->extra = serialize($entity->extra);
        }

        //Deletes all expired tokens and tokens with the same token value
        //  and/or the same user.
        $this->deleteExpired($entity);

        return true;
    }