/// <summary>
        ///     Get Average (<see cref="GetAverage(BO.Energiemenge, TimeRange, Wertermittlungsverfahren, string, Mengeneinheit)" />
        ///     )
        ///     for a pure Energiemenge with automatically found parameters.
        /// </summary>
        /// <seealso cref="IsPure"/>
        /// <param name="em">Energiemenge</param>
        /// <returns>Tuple of average value and unit of measurement</returns>
        public static Tuple <decimal?, Mengeneinheit> GetAverage(this BO.Energiemenge em)
        {
            if (!IsPure(em))
            {
                throw new ArgumentException("Energiemenge is not pure.");
            }

            if (em.Energieverbrauch.Count == 0)
            {
                return(Tuple.Create <decimal?, Mengeneinheit>(null, Mengeneinheit.KW));
            }
            var v = em.Energieverbrauch.First();

            return(Tuple.Create(em.GetAverage(v.Wertermittlungsverfahren, v.Obiskennzahl, v.Einheit), v.Einheit));
        }
 /// <summary>
 ///     Same as <see cref="GetAverage(BO4E.BO.Energiemenge)" /> but without specifying a time slice.
 /// </summary>
 /// <param name="em">Energiemenge</param>
 /// <param name="wev">type of measurement</param>
 /// <param name="obiskennzahl">OBIS</param>
 /// <param name="me">an intensive or extensive unit</param>
 /// <returns>
 ///     The average for the given Mengeneinheit for the Energiemenge object or null if there was no Verbrauch for the
 ///     given Mengeneinheit.
 /// </returns>
 public static decimal?GetAverage(this BO.Energiemenge em,
                                  Wertermittlungsverfahren wev, string obiskennzahl, Mengeneinheit me)
 {
     return(em.GetAverage(em.GetTimeRange(), wev, obiskennzahl, me));
 }