public static int?CreateOffice(Office office) { if (office == null) { throw new System.ArgumentNullException() { Source = "office" }; } using (CustomClearviewEntities ctx = new CustomClearviewEntities()) { OfficeRepository repo = new OfficeRepository(ctx); repo.Create(office); ctx.SaveChanges(); } return(office.OfficeId); }