private bool ProcessEventByHandler(
            string partition, EventReaderSubscriptionMessage.CommittedEventReceived message, out string newState,
            out string newSharedState, out string projectionResult, out EmittedEventEnvelope[] emittedEvents)
        {
            projectionResult = null;
            var newPatitionInitialized = InitOrLoadHandlerState(partition);

            _stopwatch.Start();
            EmittedEventEnvelope[] eventsEmittedOnInitialization = null;
            if (newPatitionInitialized)
            {
                _projectionStateHandler.ProcessPartitionCreated(
                    partition, message.CheckpointTag, message.Data, out eventsEmittedOnInitialization);
            }

            var result = _projectionStateHandler.ProcessEvent(
                partition, message.CheckpointTag, message.EventCategory, message.Data, out newState, out newSharedState,
                out emittedEvents);

            if (result)
            {
                var oldState = _partitionStateCache.GetLockedPartitionState(partition);
                //TODO: depending on query processing final state to result transformation should happen either here (if EOF) on while writing results
                if (/*_producesRunningResults && */ oldState.State != newState)
                {
                    if (_definesStateTransform)
                    {
                        projectionResult = _projectionStateHandler.TransformStateToResult();
                    }
                    else
                    {
                        projectionResult = newState;
                    }
                }
                else
                {
                    projectionResult = oldState.Result;
                }
            }

            _stopwatch.Stop();
            if (eventsEmittedOnInitialization != null)
            {
                if (emittedEvents == null || emittedEvents.Length == 0)
                {
                    emittedEvents = eventsEmittedOnInitialization;
                }
                else
                {
                    emittedEvents = eventsEmittedOnInitialization.Concat(emittedEvents).ToArray();
                }
            }

            return(result);
        }