/// <summary>
        /// Ends this <c>Level</c>.
        /// </summary>
        /// <param name="completed">If set to <c>true</c> completed.</param>
        public void End(bool completed)
        {
            // check end() called without matching start(),
            // i.e, the level is not running nor paused
            if (State != LevelState.Running && State != LevelState.Paused)
            {
                SoomlaUtils.LogError(TAG, "end() called without prior start()! ignoring.");
                return;
            }

            State = LevelState.Ended;

            long duration = GetPlayDurationMillis();

            LevelStorage.SetLastDurationMillis(this, duration);

            if (completed)
            {
                // Calculate the slowest \ fastest durations of level play

                if (duration > GetSlowestDurationMillis())
                {
                    LevelStorage.SetSlowestDurationMillis(this, duration);
                }

                // We assume that levels' duration is never 0
                long fastest = GetFastestDurationMillis();
                if (fastest == 0 || duration < fastest)
                {
                    LevelStorage.SetFastestDurationMillis(this, duration);
                }
            }

            if (completed)
            {
                foreach (Score score in Scores.Values)
                {
                    score.Reset(true);                     // resetting scores
                }

                SetCompleted(true);
            }

            // Count number of times this level was played
            LevelStorage.IncTimesPlayed(this);
        }