public void AddFlat(Flat newflat) { try { ServiceContext.Flats.Add(newflat); ServiceContext.SaveChanges(); OnAction(DebugLevel.Information, string.Format("Getting all deals"), "", "", DateTime.Now); } catch (Exception ex) { OnAction(DebugLevel.Error, string.Format("error adding {0}", newflat.GetType()), ex.Source, ex.StackTrace, DateTime.Now); } }