/// <summary>
        /// Created new Report Entity object based on ReportToCreateDto
        /// </summary>
        /// <param name="reportData">Data for new report</param>
        /// <param name="userId">Identifier of sumbitter</param>
        /// <param name="username">Username of submitter</param>
        /// <returns>Created instance of ReportEntity</returns>
        private ReportEntity CreateReport(ReportToCreateDto reportData, int userId, string username)
        {
            ReportEntity report = new ReportEntity
            {
                Heading             = reportData.Heading,
                Message             = reportData.Message,
                Date                = DateTime.Now,
                ModificationEntries = new List <ModificationEntryEntity>
                {
                    new ModificationEntryEntity
                    {
                        Message = $"Klient {username} stworzył(a) nowe zgłoszenie o tytule: '{reportData.Heading}'",
                        Date    = DateTime.Now
                    }
                },
                Status = StatusEnum.New,
                UserId = userId
            };

            return(report);
        }
        /// <summary>
        /// Creates and adds new report to database
        /// </summary>
        /// <param name="reportToCreate">Report data from creation form</param>
        /// <param name="userId">Identifier of submitter</param>
        /// <returns>Service result with operation status and object to return</returns>
        public async Task <IServiceResult <ReportDetailsToReturnDto> > CreateAsync(ReportToCreateDto reportToCreate, int userId)
        {
            try
            {
                UserEntity user = await _userManager.Users.Where(x => x.Id == userId).Include(r => r.Reports).FirstOrDefaultAsync();

                ReportEntity report = CreateReport(reportToCreate, userId, user.UserName);

                AttachmentEntity attachment = CreateAttachment(reportToCreate.File, userId);
                report.Attachment = attachment;

                try
                {
                    _repository.AddNew(report);
                }
                catch (Exception)
                {
                    if (report.Attachment != null)
                    {
                        string url = report.Attachment.Url;
                        await _cloudinaryManager.DeleteFileAsync(url.Substring(url.LastIndexOf('/') + 1));
                    }

                    throw;
                }

                ReportDetailsToReturnDto reportToReturn = _reportMapper.Map(report);

                return(new ServiceResult <ReportDetailsToReturnDto>(ResultType.Correct, reportToReturn));
            }
            catch (Exception)
            {
                return(new ServiceResult <ReportDetailsToReturnDto>(ResultType.Error, new List <string> {
                    "Błąd podczas tworzenia nowego zgłoszenia."
                }));
            }
        }