public void UpsertPin(Pin pPin) { // TODO make this cleaner bool doesPinExist = Pins.Any(pin => pin.PinId == pPin.PinId); if (!doesPinExist) { Pins.Add(pPin); } else { Pins[Pins.FindIndex(pin => pin.PinId == pPin.PinId)] = pPin; } }