manage side effect and improve cqrs.core