private ICollection <List> GetListsWithPositionToUpdate(int boardId, int oldPosition, int newPosition) { ICollection <List> listsWithPositionToUpdate; if (newPosition > oldPosition) { listsWithPositionToUpdate = _listRepository.GetListsInPositionRange(boardId, oldPosition, newPosition + 1); foreach (var list in listsWithPositionToUpdate) { list.Position--; } } else { listsWithPositionToUpdate = _listRepository.GetListsInPositionRange(boardId, newPosition - 1, oldPosition); foreach (var list in listsWithPositionToUpdate) { list.Position++; } } return(listsWithPositionToUpdate); }