public async Task <BidResponse> Place(BidRequestDto bidRequestDto) { var bidResponse = await ValidateBid(bidRequestDto); if (!bidResponse.Success) { return(bidResponse); } try { var bid = _mapper.Map <BidRequestDto, Bid>(bidRequestDto); var bidGuid = await Task.Run(() => _bidRepository.Place(bid)); var responseBidDto = _mapper.Map <Bid, BidRequestDto>(bid); responseBidDto.Guid = bidGuid; bidResponse.bidDto = responseBidDto; bidResponse.CurrentBidCount = _bidRepository.GetCountByAuctionItemId(bidRequestDto.AuctionItemId); bidResponse.Message = $"${bidRequestDto.Amount} bid received."; return(bidResponse); } catch (Exception e) { return(new BidResponse { Success = false, Message = $"An error occurred while placing bid : {e.Message}" }); } }