public void Configure(StateMachine <ECompetitionState, ECompetitionEvent> stateMachine, Competition competition)
        {
            ICompetitionWorkflowGuard competitionGuard = new CompetitionWorkflowGuard(_userPrincipalProvider,
                                                                                      competition);

            stateMachine.Configure(ECompetitionState.OnEdit)
            .PermitIf(ECompetitionEvent.SendToModeration, ECompetitionState.OnModeration, () => _actorProvider.CurrentActorIs(EActor.User) && competitionGuard.ActorIsCreator);
        }
        public void Configure(StateMachine <ECompetitionState, ECompetitionEvent> stateMachine, Competition competition)
        {
            ICompetitionWorkflowGuard competitionGuard = new CompetitionWorkflowGuard(_userPrincipalProvider,
                                                                                      competition);

            stateMachine.Configure(ECompetitionState.OnModeration)
            .PermitIf(ECompetitionEvent.Open, ECompetitionState.Opened, () => _actorProvider.CurrentActorIs(EActor.User))
            .PermitIf(ECompetitionEvent.ReturnToEdit, ECompetitionState.OnEdit, () => _actorProvider.CurrentActorIs(EActor.User) && _userPrincipalProvider.CurrentUserHasPermission(EPermission.CompetitionModerate) && competitionGuard.HasReasonToFix);
        }