private IInvoiceFormGenerationContext PrepareContext(int formTypeId, int year, int month)
        {
            var existingCollection = m_invoiceFormsRepository.FindCollection(formTypeId, year, month);

            if (existingCollection?.ApproveUserId != null)
            {
                throw new InvalidOperationException("J*z bylo vygenerovano");
            }

            var preapprovedMessages = new HashSet <string>();

            if (existingCollection != null)
            {
                foreach (var m in existingCollection.Log.Where(l =>
                                                               l.IsWarning && (l.ApproveUserId == m_session.User.Id)))
                {
                    preapprovedMessages.Add(m.Message);
                }

                m_invoiceFormsRepository.DeleteCollection(existingCollection.Id);
            }

            var context = m_invoiceFormsRepository.StartGeneration($"{month.ToString().PadLeft(2, '0')}/{year}",
                                                                   year,
                                                                   month,
                                                                   formTypeId);

            context.AutoApproveWarnings(preapprovedMessages);
            return(context);
        }
 public void DeleteCollection(int id)
 {
     m_invoiceFormsRepository.DeleteCollection(id);
 }