private static void HandleFriendshipAdded(IUserDatabase userDatabase, IInternalLocalUser localUser, AbstractAddFriendshipNotificationEventArgs e)
    {
        AddFriendshipNotification notification = e.Notification;
        User friend = notification.Friend;

        userDatabase.PersistUser(friend.UserId, friend.HashedUserId, friend.DisplayName, friend.FirstName, friend.Status);
        FriendDocument friendDocument = new FriendDocument();

        friendDocument.Swid      = friend.UserId;
        friendDocument.IsTrusted = notification.IsTrusted.Value;
        friendDocument.Nickname  = null;
        FriendDocument doc = friendDocument;

        userDatabase.InsertFriend(doc);
        long value = e.Notification.FriendshipInvitationId.Value;

        userDatabase.DeleteFriendInvitation(value);
        localUser.AddFriend(friend, notification.IsTrusted.Value, value);
    }
 public static bool Validate(AddFriendshipNotification notification)
 {
     return(Validate((BaseNotification)notification) && notification.FriendshipInvitationId.HasValue && notification.Friend != null && notification.Friend.DisplayName != null && notification.Friend.UserId != null && notification.IsTrusted.HasValue);
 }
 public AddFriendshipNotificationEventArgs(AddFriendshipNotification notification)
 {
     Notification = notification;
 }
        private void Dispatch(AddFriendshipNotification notification)
        {
            AddFriendshipNotificationEventArgs e = new AddFriendshipNotificationEventArgs(notification);

            this.OnFriendshipAdded(this, e);
        }