void WriteParameters(Message message, CodeWriter writer)
 {
     var first = true;
     foreach (var member in message.Members)
     {
         if (first)
         {
             first = false;
         }
         else
         {
             writer.Write(", ");
         }
         writer.Write("{0} {1}", member.Type, GeneratorUtil.ParameterCase(member.Name));
     }
 }
        private void WriteContext(CodeWriter writer, Context context)
        {
            foreach (var contract in context.Contracts)
            {
                writer.Write(ClassNameTemplate, contract.Name);

                if (contract.Modifiers.Any())
                {
                    writer.Write(" : {0}", string.Join(", ", contract.Modifiers.Select(s => s.Interface).ToArray()));
                }
                writer.WriteLine();

                writer.WriteLine("{");
                writer.Indent += 1;

                if (contract.Members.Count > 0)
                {
                    WriteMembers(contract, writer);
                    writer.WriteLine(PrivateCtorTemplate, contract.Name);
                    writer.Write("public {0} (", contract.Name);
                    WriteParameters(contract, writer);
                    writer.WriteLine(")");
                    writer.WriteLine("{");

                    writer.Indent += 1;
                    WriteAssignments(contract, writer);
                    writer.Indent -= 1;

                    writer.WriteLine("}");

                }

                writer.Indent -= 1;
                writer.WriteLine("}");
            }
            foreach (var entity in context.Entities)
            {
                if ((entity.Name ?? "null") == "null")
                    continue;

                GenerateEntityInterface(entity, writer, "?", "public interface I{0}Aggregate");
                GenerateEntityInterface(entity, writer, "!", "public interface I{0}AggregateState");
            }
        }