Let's move this code into a ruby class in the services directory. The name of the file would be create_active_directory_account, or even active_directory with several methods. The input would be the user class. At the end, it could call user a user method that would set directory_enabled_at and call save