javascript check if object with id exists in array