public int SavePermissions(int roleId, IList <Role2Module> permissions) { var theRole = GetById(roleId, false); if (theRole == null) { throw new Exception(GeneralMessages.NotFound, new Exception { Source = GeneralMessages.ExceptionSource }); } if (permissions != null && permissions.Count >= 0) { using (var transactionScope = new TransactionScope()) { _permissionService.DeleteByRoleId(roleId); var result = _permissionService.BulkInsert(permissions); transactionScope.Complete(); return(result); } } return(_permissionService.DeleteByRoleId(roleId)); }