Rotate object around a center object Unity3D

Hi guys I wrote this code to rotate an object around a center object but I am doing somthing wrong could someone explain me what :)? The idea is that it gets the angle between the center object and the mouse position and based on that angle it must rotate the camera around the canter object.

public GameObject player;

void Update()

public void RotateCamera(GameObject _center)
    float speedMod = 10.0f;
    Vector3 mousePos = camera.WorldToScreenPoint(Input.mousePosition);
    Vector3 centerPos = _center.transform.position;
    Camera.mainCamera.transform.RotateAround (centerPos,mousePos,20 * Time.deltaTime * speedMod);

create a new empty gameobject where you want a pivot point. then make your camera parent of the empty object. then just rotate the new empty object!