Use early return to reduce the levels of indentation. Extract logic to find object in container into helper function.