public void WriteAllAccessRights(DashboardUser[] DashboardUser) { StoredProcedureDataContext dbmlObject = new StoredProcedureDataContext(); dbmlObject.DeleteUsersFromDashboard(DashboardUser[0].DashboardId); dbmlObject.SubmitChanges(); for (var i = 0; i < DashboardUser.Length; i++) { dbmlObject.AddUserToDashboard(DashboardUser[i].AccessRight.AccessRightName, DashboardUser[i].DashboardId, DashboardUser[i].UserId); dbmlObject.SubmitChanges(); } }