private static bool SetSceneHasData(IMongoDbProvider <SceneItem, string> mgdb, string sceneID) { try { if (null != mgdb.GetAll(o => o.SceneID == sceneID)) { return(true); } using (var db = new BCEnterpriseContext()) { var scene = db.Scenes.First(o => o.SceneID == sceneID); if (!scene.HasData) { return(true); } scene.HasData = false; return(0 < db.SaveChanges()); } } catch (Exception ex) { throw ex; } }