protected override bool ReceiveCommand(object message)
{
return message.Match()
.With<Increment>(_ => Persist(new CounterChanged(1), UpdateState))
.With<Increment>(_ => Persist(new CounterChanged(-1), UpdateState))
.With<Get>(_ => Sender.Tell(_count))
.With<ReceiveTimeout>(_ => Context.Parent.Tell(new Passivate(Stop.Instance)))
.With<Stop>(_ => Context.Stop(Self))
.WasHandled;
}