/// <summary>
        ///     #1. Check operation duration.
        ///     BreakDuration changes for receptions, buyer gatheriond and (probably) for
        ///     packing operation (if it was fast packing).
        /// </summary>
        /// <param name="action"></param>
        /// <param name="momento"></param>
        /// <returns></returns>
        public (Period, EmployeeActionBase) CheckDuration(EmployeeActionBase action, ShortBreakInspectorMomento momento)
        {
            if (action.Operation == null)
            {
                throw new ArgumentException(@"Operation cannot be null.", nameof(action.Operation));
            }

            Period period;

            switch (action.GetOperationGroup())
            {
            case OperationGroups.Packing:
                var newDuration = (( DoubleAddressAction )action).GetPackingDuration(new[] { 7.0, 8.0, 9.0, 10.0 });
                period = new Period(action.StartTime, action.StartTime.Add(newDuration));
                break;

            case OperationGroups.BuyerGathering:
                newDuration = (( DoubleAddressAction )action).GetBuyerGatheringDuration(5, 30, 60);
                period      = new Period(action.StartTime, action.StartTime.Add(newDuration));
                break;

            case OperationGroups.Reception:
                period = new Period(action.StartTime, action.StartTime.Add(action.Duration + TimeSpan.FromSeconds(10)));
                break;

            default:
                period = new Period(action.StartTime, action.StartTime.Add(action.Duration));
                break;
            }

            if (!momento.ProductivityMap.ContainsKey(action.Operation))
            {
                momento.ProductivityMap[action.Operation] = new Productivity();
            }
            momento.ProductivityMap[action.Operation].Add(action, period);

            return(period, action);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="action"></param>
        public void AddAction(EmployeeActionBase action)
        {
            if (_lastAction != null)
            {
                var lastActionEnd = _lastAction.StartTime.Add(_lastAction.Duration);

                if (lastActionEnd > action.StartTime)
                {
                    var diff = lastActionEnd - action.StartTime;
                    _lastAction.Duration -= diff;

                    var lastOperation = ( int )_lastAction.GetOperationGroup();
                    _actions[lastOperation].Duration -= diff;
                }
            }

            var pause = _pause.GetPauseInterval(_lastAction, action);

            _pauses.Enqueue(pause);

            if (pause > _pauseThreshold)
            {
                // OffTime
                //_actions[ _actions.Length - 1 ].AddDetails( new EmployeeActionBase(), pause - _pauseThreshold );
                pause = _pauseThreshold;
            }

            if (pause < TimeSpan.Zero)
            {
                pause = _pauseThreshold;
            }

            var operation = ( int )action.GetOperationGroup();

            _actions[operation].AddDetails(action, pause);

            UpdateLastAction(action);
        }