private string RemoveFromElementFromList(List<int> orderList, int id) { string newProjectOrder = null; orderList.Remove(id); foreach (int y in orderList) { newProjectOrder += y + " "; } if (newProjectOrder != null) { newProjectOrder = newProjectOrder.TrimEnd().Replace(' ', ','); } return newProjectOrder; }