public ControllerStateHistory ReplaceState(ISqLiteContext ctx, Models.ControllerStateInformation newStateModel, Models.ControllerStateInformation oldStateModel) { var newState = _entityFactory.CreateControllerStateInformation(newStateModel); var oldState = _entityFactory.CreateControllerStateInformation(oldStateModel); var terminationDate = TerminateState(ctx, oldState); return(ActivateState(ctx, newState, terminationDate)); }