Add to_hash method to session command