public void DeleteGroup(int id) { using (var structureRepository = new StructureRepository(ApplicationContext.DatabaseContext.Database, ApplicationContext.Services.MemberService)) { var model = structureRepository.GetById(id); if (model == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } structureRepository.Delete(model); } }