public int DeleteTeamServer(int id) { using (TeamServerRepository repository = new TeamServerRepository()) { TeamServer server = repository.GetById(id); if (server != null) { return(repository.Delete(server)); } else { throw new Exception(string.Format("Server with specifed id {0} does not exist.", id)); } } }