public int AddTag(string tagName) { using (geekinsidekmsEntities context = new geekinsidekmsEntities()) { Tag dbTag = new Tag { TagName = tagName }; try { context.AddToTags(dbTag); context.SaveChanges(System.Data.Objects.SaveOptions.DetectChangesBeforeSave); }catch(Exception e){ System.Diagnostics.Debug.WriteLine(e.InnerException.Message); } return dbTag.Id; } }