Duplicated logic in `setEntity()`. Forgivable for such a small snippet though.

`scheduledTask` is leaked and never canceled if `resume()` or `setEntity()` is inadvertently invoked multiple times.