List<Schedule> nextSchedules = htl.find("from Schedule where position > ?", schedule.getPosition());
for (Schedule nextSchedule : nextSchedules)
{
nextSchedule.setPosition(nextSchedule.getPosition() - 1);
htl.update(nextSchedule);
}
if (schedule.getPosition() != maxPosition)
{
schedule.setPosition(maxPosition);