public static Configuration CreateConfiguration(Configuration configuration)
        {
            configuration.User = null;
            configuration.EnergyType = null;
            configuration.Periodicity = null;

            using (var ctx = new Entities())
            {
                ctx.Configurations.Add(configuration);
                ctx.SaveChanges();

                return configuration;
            }
        }
        public static void UpdateConfiguration(Configuration configuration)
        {
            using (var ctx = new Entities())
            {
                var conf = ctx.Configurations
                    .Single(c => c.Id == configuration.Id);

                conf.EnergyTypeId  = configuration.EnergyTypeId;
                conf.PeriodicityId = configuration.PeriodicityId;
                conf.Name          = configuration.Name;
                conf.Order         = configuration.Order;

                ctx.SaveChanges();
            }
        }