public async Task <bool> DeletePublicTemplateAsync(int templateId, int userId)
        {
            PublicTrainingTemplate template = await publicTemplateRepository.GetByIdAsync(templateId);

            if (template is null || template.Template.CreatorId != userId)
            {
                return(false);
            }

            await publicTemplateRepository.DeleteAsync(template);

            await publicTemplateRepository.SaveChangesAsync();

            return(true);
        }
        public async Task <PublicTrainingTemplateDto> AddPublicTemplateAsync(int templateId, int userId)
        {
            TrainingTemplate template = await templateRepository.GetByIdAsync(templateId);

            if (template is null ||
                template.CreatorId != userId ||
                template.publicTraining is not null)
            {
                return(null);
            }

            PublicTrainingTemplate publicTemplate =
                await publicTemplateRepository.AddAsync(new PublicTrainingTemplate()
            {
                Template = template
            });

            await publicTemplateRepository.SaveChangesAsync();

            return(mapper.Map <PublicTrainingTemplate, PublicTrainingTemplateDto>(publicTemplate));
        }