private FriendBM ConvertToFriendBM(UserBM model) { UserGeneralInformationBL userGeneralInfoBL = new UserGeneralInformationBL(); UserGeneralInformationBM userGeneralInfoBM=new UserGeneralInformationBM(); userGeneralInfoBM=userGeneralInfoBL.GetGeneralInformationByUserId(model.Id); FriendBM frnd = new FriendBM(); frnd.UserId = CurrentUser; frnd.FriendName = model.Name; frnd.FriendCommunity = model.CommunityName; if (userGeneralInfoBM != null) frnd.FriendImage = string.IsNullOrEmpty(userGeneralInfoBM.Image) ? null : userGeneralInfoBM.Image; var friend = uow.FriendRepository.Find(x => x.UserId == CurrentUser && x.FriendId == model.Id).FirstOrDefault(); if (friend == null) { frnd.FriendId = model.Id; frnd.FriendShipStatusId = 0; } else { frnd.Id = friend.Id; frnd.FriendShipStatusId = friend.FriendShipStatusId; frnd.FriendId = friend.FriendId; frnd.CreationDate = friend.CreationDate; } return frnd; }