/// <summary>
        /// Get an entity by its unique identifier
        /// </summary>
        /// <param name="entity">Entity unique identifier</param>
        /// <returns>The entity</returns>
        public T New(T entity)
        {
            try
            {
                using (var context = new MonzonEntities())
                {
                    entity = context.Set <T>().Add(entity);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error creating entity"), ex);
            }

            return(entity);
        }
        /// <summary>
        /// Returns the entity number of rows
        /// </summary>
        /// <returns>Entity number of rows</returns>
        public long Count()
        {
            long count;

            try
            {
                using (MonzonEntities context = new MonzonEntities())
                {
                    count = context.Set <T>().Count();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error reading entity number of rows", ex);
            }

            return(count);
        }
        /// <summary>
        /// Get an entity by its unique identifier
        /// </summary>
        /// <param name="id">Entity unique identifier</param>
        /// <returns>The entity</returns>
        public T Get(long id)
        {
            T entity;

            try
            {
                using (var context = new MonzonEntities())
                {
                    entity = context.Set <T>().Find(id);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Error getting entity with id {0}", id), ex);
            }

            return(entity);
        }