public function applyCode($code, $callback = null)
    {
        try {
            if ($promocode = Promocodes::check($code)) {
                if ($promocode->users()->wherePivot(config('promocodes.related_pivot_key'), $this->id)->exists()) {
                    throw new AlreadyUsedException;
                }

                $promocode->users()->attach($this->id, [
                    config('promocodes.foreign_pivot_key') => $promocode->id,
                    'used_at' => Carbon::now(),
                ]);

                $promocode->load('users');

                if (is_callable($callback)) {
                    $callback($promocode);
                }

                return $promocode;
            }
        } catch (InvalidPromocodeException $exception) {
            //
        }

        if (is_callable($callback)) {
            $callback(null);
        }

        return null;
    }