public static CommandProcess Start(string email)
        {
            var state = AccountState.FromStorage(AccountStore.AccountStates.SingleOrDefault(x => x.Email == email));

            if (state == null)
            {
                throw new Exception("Not found");
            }

            var account = Account.Create(state);

            return(new CommandProcess(state, account));
        }
        public void Handle(BecomeCustomerCommand command)
        {
            var state = AccountState.FromStorage(AccountStore.AccountStates.SingleOrDefault(x => x.Email == command.Email)) ?? new AccountState();

            var agg = Account.Create(state);

            agg.BecomeCustomer(command.Email, command.Username);

            foreach (var change in agg.Changes())
            {
                EventStore.Add(change);
            }

            AccountStore.AccountStates.Add(state.ToStorage());
        }
        public void Handle(AddCreditCardCommand command)
        {
            var state = AccountState.FromStorage(AccountStore.AccountStates.SingleOrDefault(x => x.Email == command.Email));

            if (state == null)
            {
                throw new Exception("Not found");
            }

            var agg = Domain.Account.Create(state);

            agg.AddCreditCard(command.CreditCard);

            foreach (var change in agg.Changes())
            {
                EventStore.Add(change);
            }

            AccountStore.Update(state.ToStorage());
        }