private static async Task AddUserRoleHistory(UsersInRole current, UserRoleOperations op) { UsersRoleHistoryServiceProxy hrhsvc = new UsersRoleHistoryServiceProxy(); UsersRoleHistorySet urhs = new UsersRoleHistorySet(); UsersRoleHistory urh = new UsersRoleHistory(); urh.UserID = current.UserID; urh.RoleID = current.RoleID; urh.SubPriority = current.SubPriority; urh.OperatorID = current.AdminID; urh.ChangeDate = DateTime.UtcNow; switch (op) { case UserRoleOperations.Added: urh.Operation = urhs.OperationValues[0]; break; case UserRoleOperations.Modified: urh.Operation = urhs.OperationValues[1]; break; case UserRoleOperations.Deleted: urh.Operation = urhs.OperationValues[2]; break; } await hrhsvc.AddOrUpdateEntitiesAsync(Cntx, urhs, new UsersRoleHistory[] { urh }); }