public Task <FileMessage> SendImage(GroupChannel channel, string userId, string userName, string memberToken, string fileUrl, string date) { var tcs = new TaskCompletionSource <FileMessage>(); if (channel == null) { tcs.TrySetCanceled(); return(tcs.Task); } var file = new SBFile(fileUrl); channel.SendFileMessage(file, file.FileName, "image/jpeg", (int)file.Length, date, (FileMessage message, SendBirdException e) => { if (e != null) { tcs.TrySetCanceled(); } tcs.TrySetResult(message); SendPushNotification(userId, userName, memberToken, "", NotificationType.Image); }); return(tcs.Task); }