code: function createUser(form) {
        // refuse to work with invalid data
        if (vm.user._id || (form && !form.$valid)) {
          return;
        }
  
        Auth.createUser(vm.user)
          .then(createUserSuccess)
          .catch(createUserCatch);
  
        function createUserSuccess(newUser) {
          Toast.show({
            type: 'success',
            text: 'User ' + newUser.name + ' has been created',
            link: {state: 'admin.user.list.detail', params: {id: newUser._id}}
          });
          vm.close();
        }
  
        function createUserCatch(err) {
          if (form && err) {
            form.setResponseErrors(err);
          }
  
          Toast.show({
            type: 'warn',
            text: 'Error while creating a new user'
          });
        }
      }
docs: @ngdoc function
  @name create
  @methodOf <%= scriptAppName %>.admin.user.create.controller:UserCreateController
  @description
  Create a new user by using the UserService create method
  
  @param {form} [form] The form to gather the information from