Dynamics of gas and dust clouds in active galactic nuclei