public function inviteToTeam( $user, $team = null, callable $success = null )
    {
        if ( is_null( $team ) )
        {
            $team = $this->user()->current_team_id;
        } elseif( is_object( $team ) )
        {
            $team = $team->getKey();
        }elseif( is_array( $team ) )
        {
            $team = $team["id"];
        }

        if( is_object( $user ) && isset($user->email) )
        {
            $email = $user->email;
        } elseif( is_string($user) ) {
            $email = $user;
        } else {
            throw new \Exception('The provided object has no "email" attribute and is not a string.');
        }

        $invite               = $this->app->make(Config::get('teamwork.invite_model'));
        $invite->user_id      = $this->user()->getKey();
        $invite->team_id      = $team;
        $invite->type         = 'invite';
        $invite->email        = $email;
        $invite->accept_token = md5( uniqid( microtime() ) );
        $invite->deny_token   = md5( uniqid( microtime() ) );
        $invite->save();

        if ( !is_null( $success ) )
        {
            event(new UserInvitedToTeam($invite));
            return $success( $invite );
        }
    }