private void PlaceObject()
    {
        if (current == null)
        {
            return;
        }

        if (previewGO == null)
        {
            previewGO = current.GetPreviewGameObject();

            previewGO.transform.localRotation = Quaternion.Euler(lastRotation);

            previewSceneGameObject = previewGO.GetComponent <SceneGameObject>();

            if (previewSceneGameObject == null)
            {
                previewSceneGameObject = previewGO.AddComponent <SceneGameObject>();
            }

            previewSceneGameObject.isPlacingMode = true;

            currentObjectLayer = previewGO.layer;
            previewGO.RunOnChildrenRecursive((GameObject g) => { g.layer = placementLayer; });
        }

        if (Input.GetKeyDown(KeyCode.Q))
        {
            previewGO.transform.Rotate(new Vector3(0, 1, 0), 90);
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            previewGO.transform.Rotate(new Vector3(0, 1, 0), -90);
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            ResetCurrent(true);
            return;
        }


        if (TryRaycastFromScreen(current.GetLayerMask(), out RaycastHit hit))
        {
            Transform objectHit       = hit.transform;
            Vector3   hitPointOnPlane = hit.point;
            float     x = hitPointOnPlane.x - hitPointOnPlane.x % gridSize;
            float     z = hitPointOnPlane.z - hitPointOnPlane.z % gridSize;
            float     y = hitPointOnPlane.y - hitPointOnPlane.y % gridSize;

            previewGO.transform.position = hitPointOnPlane;

            SceneGameObject sco = objectHit.GetComponentInParent <SceneGameObject>();

            if (sco != null)
            {
                if (sco.CanHoldItem(previewSceneGameObject))
                {
                    previewGO.SetActive(false);
                    SessionManager.Instance.SetSelected(sco.data.id);
                }
            }
            else
            {
                previewGO.SetActive(true);
                SessionManager.Instance.SetSelected(null);
            }

            if (Input.GetMouseButtonDown(0) && (!previewSceneGameObject.isColliding || sco != null))
            {
                Transform p = sco != null ? sco.transform : items.transform;
                previewGO.transform.parent = p;

                previewGO.RunOnChildrenRecursive((GameObject g) => { g.layer = currentObjectLayer; });
                previewSceneGameObject.isPlacingMode = false;
                lastRotation = previewSceneGameObject.transform.localRotation.eulerAngles;

                SceneGameObject instanced = current.Instantiate(p,
                                                                previewGO.transform.localPosition, previewGO.transform.localRotation);

                SessionManager.Instance.AddSceneGameObject(instanced);

                if (sco != null)
                {
                    sco.HoldItem(instanced);
                }

                Destroy(previewGO);

                previewGO = null;
            }
        }
    }