How to check if the model is out of the camera Frostrum?

Hello! I have a problem with camera movement inside a viewport. I want to check if the model is outside of camera view and if it is I want place the model back to camera view. Would greatly appreciate your help!