/// <see cref="IFunctionalService.CreateToState(Guid, string, stateType, string, string)"/> public virtual stateType CreateToState(Guid id, string phaseName, stateType item = null, string zone = null, string context = null) { Job job = repository.Retrieve(id); Phase phase = getPhase(job, phaseName); RightsUtils.CheckRight(phase.StatesRights, new Right(RightType.CREATE, RightValue.APPROVED)); PhaseState state = MapperFactory.CreateInstance <stateType, PhaseState>(item); job.UpdatePhaseState(phaseName, state.Type, state.Description); repository.Save(job); return(MapperFactory.CreateInstance <PhaseState, stateType>(phase.GetCurrentState())); }