honestly I don't like this code pattern. You are deletting keys from the object that is given as argument. The caller might have a little surprise after he runs this method.