/// <summary>
        /// Save a Preset
        /// </summary>
        /// <param name="dc">DataContext</param>
        /// <param name="preset"></param>
        /// <returns>returns the id of the saved preset</returns>
        public int Save(DataContext dc, Domain.Preset preset)
        {
            dc = dc ?? Conn.GetContext();
            var dbPreset = dc.Presets.Where(p => p.PresetID == preset.ID).SingleOrDefault();
            var isNew    = false;

            if (dbPreset == null)
            {
                dbPreset = new Preset();
                isNew    = true;
            }

            dbPreset.Name                    = preset.Name;
            dbPreset.UserID                  = preset.UserID;
            dbPreset.IdealTemperature        = preset.IdealTemperature;
            dbPreset.TemperatureThreshold    = preset.TemperatureThreshold;
            dbPreset.IdealLightIntensity     = preset.IdealLightIntensity;
            dbPreset.LightIntensityThreshold = preset.LightIntensityThreshold;
            dbPreset.IdealHumidity           = preset.IdealHumidity;
            dbPreset.HumidityThreshold       = preset.HumidityThreshold;
            dbPreset.IdealWaterLevel         = preset.IdealWaterLevel;
            dbPreset.WaterLevelThreshold     = preset.WaterLevelThreshold;
            dbPreset.IsGlobal                = preset.IsGlobal;
            dbPreset.DateUpdated             = DateTime.Now;

            if (isNew)
            {
                dbPreset.DateCreated = DateTime.Now;
                dc.Presets.InsertOnSubmit(dbPreset);
            }
            dc.SubmitChanges();
            return(dbPreset.PresetID);
        }
        /// <summary>
        /// Delete a single Preset
        /// </summary>
        /// <param name="dc">DataContext</param>
        /// <param name="preset"></param>
        public void Delete(DataContext dc, Domain.Preset preset)
        {
            dc = dc ?? Conn.GetContext();
            var dbPreset = dc.Presets.Where(p => p.PresetID == preset.ID).SingleOrDefault();

            if (dbPreset == null)
            {
                return;
            }
            dc.Presets.Attach(dbPreset, true);
            dc.Presets.DeleteOnSubmit(dbPreset);
            dc.SubmitChanges();
        }